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;
31
use MT::Plugin::itex2MML;
33
eval{ require MT::Plugin;};
36
name => "TextileMarkdownMML",
38
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.",
39
doc_link => 'http://golem.ph.utexas.edu/~distler/blog/archives/000374.html',
41
MT->add_plugin(new MT::Plugin($plugin));
44
my $filters = MT->all_text_filters();
46
if (exists($filters->{'textile_1'})) {
47
MT->add_text_filter('textile_1MML' => {
48
label => 'Textile with itex to MathML',
49
on_format => sub { &textileMML; },
52
if (exists($filters->{'markdown'})) {
53
MT->add_text_filter('markdownMML' => {
54
label => 'Markdown with itex to MathML',
55
on_format => sub { &markdownMML; },
64
# now call apply_text_filters() to do the job
65
$text=MT->apply_text_filters($text, ['itexToMML'], $ctx);
66
$text=MT->apply_text_filters($text, ['textile_1'], $ctx);
76
# now call apply_text_filters() to do the job
77
$text=MT->apply_text_filters($text, ['itexToMML'], $ctx);
78
$text=MT->apply_text_filters($text, ['markdown'], $ctx);