The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MT::Plugin::BeautifierWithEmacs - plug-in for Movable Type to use Syntax::Highlight::WithEmacs

VERSION

version 0.1

DESCRIPTION

due to this module being a MT plug-in, its installation is a bit different. You need to copy the directory MT/Plugin/BeautifierWithEmacs into your $MT_HOME/plugins directory (ex. /var/www/lib/mt5/plugins)

MT will then autoload it on the next FCGI/Webserver restart

USAGE

the plug-in is modeled after the (now defunct) MTCodeBeautifier plug-in. To use it in a template, the code is:

    <MTCodeBeautifier language="pl">
      my $x = 42;
    </MTCodeBeautifier>

To use it inside of posts, you need the MTMacro plug-in.

Quoting the original docs:

``After installing MTMacro, surround your <MTEntryBody> tags in your Movable Type templates with <MTMacroApply></MTMacroApply>. Place the following macro definition somewhere in each of the templates you want to use MTCodeBeautifier on your posts:

    <MTMacroDefine name="beautifier" ctag="code">
     <MTCodeBeautifier language="[MTMacroAttr name='language']">
      <MTMacroContent>
     </MTCodeBeautifier>
    </MTMacroDefine>

Then, in your posts, surround your code with

    <code language="my-language"></code>

"my-language" is passed on as the $mode parameter to Syntax::Highlight::WithEmacs, so it should be a file extension registered with Emacs, such as "pl". Note: you don't have to use this macro. It's just a suggestion.´´

TEXTILE2

to use this plug-in with MT-Textile (original site defunct, now bundled with MT), you have to modify textile2.pl yourself, I'm sorry! a unified diff file that you can apply with patch is included in this module's installation directory.

The gist for manual modification: Replace all the if/elsif statements and manual calls to Voisen::CodeBeautifier::highlight_(somelanguage) with one single call to

    $code = Voisen::CodeBeautifier::highlight($code, $lang) if $lang;

and save the file.

AUTHOR

Ailin Nemui <ailin at devio dot us>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Ailin Nemui.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.