1
# TextileMarkdownMML.pl
3
# Provides two MT text filters
8
# You must have the itex2MML, Textile 1.1 and Markdown filters already installed
9
# This filter first runs your text through itex2MML and then through
10
# either Textile or Markdown.
12
# The Textile+itex2MML filter requires a small patch to the Textile 1.1 plugin.
14
# http://golem.ph.utexas.edu/~distler/blog/archives/000374.html
16
# Based on textileMML.pl, by Yuan-Chung Cheng.
18
# Copyright, 2004-2007, Jacques Distler.
19
# This code is released under the GPL
22
package MT::Plugins::TextileMarkdownMML;
24
use vars qw($VERSION);
30
use MT::Template::Context;
32
eval{ require MT::Plugin;};
35
name => "TextileMarkdownMML",
37
description => "A Text-Filter, adding support for embedded itex equations to Markdown and/or Textile 1.1. Requires itex2MML and one or both of the latter plugins be installed.",
38
doc_link => 'http://golem.ph.utexas.edu/~distler/blog/archives/000374.html',
40
MT->add_plugin(new MT::Plugin($plugin));
43
my $filters = MT->all_text_filters();
45
if (exists($filters->{'textile_1'}) && exists($filters->{'itexToMML'})) {
46
MT->add_text_filter('textile_1MML' => {
47
label => 'Textile with itex to MathML',
48
on_format => sub { &textileMML; },
51
if (exists($filters->{'markdown'}) && exists($filters->{'itexToMML'})) {
52
MT->add_text_filter('markdownMML' => {
53
label => 'Markdown with itex to MathML',
54
on_format => sub { &markdownMML; },
63
# now call apply_text_filters() to do the job
64
$text=MT->apply_text_filters($text, ['itexToMML'], $ctx);
65
$text=MT->apply_text_filters($text, ['textile_1'], $ctx);
75
# now call apply_text_filters() to do the job
76
$text=MT->apply_text_filters($text, ['itexToMML'], $ctx);
77
$text=MT->apply_text_filters($text, ['markdown'], $ctx);