Writing a WikiText plug-in for MovableTypeEdit
The script
Here’s the first version of my first MovableType plugin:
#!/usr/bin/perl
# $Id: wikitext.pl 66 2007-03-13 16:09:23Z wincent $
# If you do not have Text::MediawikiFormat installed:
#
#   sudo perl -MCPAN -e 'install "Text::MediawikiFormat"'
#
#
package WikiText;
use strict;
use warnings;
use vars qw($VERSION);
$VERSION = '0.1';
require MT;
import MT;
require MT::Plugin;
import MT::Plugin;
MT->add_plugin(
    new MT::Plugin({
        name        => 'WikiText',
        description => "MediaWiki-to-HTML formatting plugin. (Version: $VERSION)"
        }));
MT->add_text_filter('wikitext' => {
    label       => 'WikiText',
    on_format   => sub {
        require Text::MediawikiFormat;
        my $text        = shift;
        my $context     = shift;
        my $converted   = Text::MediawikiFormat::format($text, {}, { prefix => 'http://wincent.dev/wiki/' });
        $converted;
    }
});
Installation
- Install into 
plugins 
- Activate in the MovableType control panel
 
Usage
- Select "WikiText" from the Text Formatting pop-up menu while composing your entry.
 
- Publish.
 
See also
- MovableType API documentation: http://www.sixapart.com/movabletype/docs/mtapi_mt.html
 
- "How to Write a Plugin": http://www.sixapart.com/movabletype/docs/plugin-tut
 
- Accompanying article on weblog: http://wincent.dev/a/about/wincent/weblog/archives/2007/03/using_mediawiki.php
 
plugins- Select "WikiText" from the Text Formatting pop-up menu while composing your entry.
 - Publish.