# TextileMarkdownMML.pl # # Provides two MT text filters # # Textile+itex2MML # Markdown+itex2MML # # You must have the itex2MML, Textile 1.1 and Markdown filters already installed # This filter first runs your text through itex2MML and then through # either Textile or Markdown. # # The Textile+itex2MML filter requires a small patch to the Textile 1.1 plugin. # See: # http://golem.ph.utexas.edu/~distler/blog/archives/000374.html # # Based on textileMML.pl, by Yuan-Chung Cheng. # # Copyright, 2004, Jacques Distler. # This code is released under the GPL # package MT::Plugins::TextileMarkdownMML; use vars qw($VERSION); $VERSION = 1.1.0.6; use strict; use MT; use MT::Template::Context; my $filters = MT->all_text_filters(); if (exists($filters->{'textile_1'})) { MT->add_text_filter('textile_1MML' => { label => 'Textile with itex to MathML', on_format => sub { &textileMML; }, }); } if (exists($filters->{'markdown'})) { MT->add_text_filter('markdownMML' => { label => 'Markdown with itex to MathML', on_format => sub { &markdownMML; }, }); } sub textileMML { my $text=shift; my $ctx=shift; # now call apply_text_filters() to do the job $text=MT->apply_text_filters($text, ['itexToMML'], $ctx); $text=MT->apply_text_filters($text, ['textile_1'], $ctx); $text; } sub markdownMML { my $text=shift; my $ctx=shift; # now call apply_text_filters() to do the job $text=MT->apply_text_filters($text, ['itexToMML'], $ctx); $text=MT->apply_text_filters($text, ['markdown'], $ctx); $text; } 1;