MojoMojo::Formatter::Main - MojoMojo's main formatter, dispatching between


MojoMojo documentation Contained in the MojoMojo distribution.

Index


Code Index:

NAME

Top

MojoMojo::Formatter::Main - MojoMojo's main formatter, dispatching between Textile and MultiMarkdown

DESCRIPTION

Top

This is the main MojoMojo formatter, which transforms lightweight plain text markup into XHTML. It reads the site preference main_formatter and calls the corresponding formatter, either Text::Textile, or Text::MultiMarkdown.

METHODS

Top

format_content_order

Format order can be 1-99. The main formatter runs on 15.

format_content

Calls the formatter. Takes a ref to the content as well as the context object. The latter is needed in order to determine the main formatter via a call to $c->pref('main_formatter').

SEE ALSO

Top

MojoMojo, Module::Pluggable::Ordered, Text::Textile

AUTHORS

Top

Marcus Ramberg <mramberg@cpan.org>

LICENSE

Top

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.


MojoMojo documentation Contained in the MojoMojo distribution.
package MojoMojo::Formatter::Main;

use parent 'MojoMojo::Formatter';

sub format_content_order { 15 }

sub format_content {
    my ( $class, $content, $c ) = @_;

    # dispatch to the preferred formatter
    if ($c->pref('main_formatter') eq 'MojoMojo::Formatter::Textile') {
        require MojoMojo::Formatter::Textile;
        $$content = MojoMojo::Formatter::Textile->main_format_content($content);
    } else {
        require MojoMojo::Formatter::Markdown;
        $$content = MojoMojo::Formatter::Markdown->main_format_content($content);
    }
}

1;