|
NAMEMojoMojo::Formatter - Base class for all formattersSYNOPSISpackage MojoMojo::Formatter::Simple; use parent qw/MojoMojo::Formatter/; sub format_content_order { 14 } # so that it runs after inclusion of obscene web sites # (MojoMojo::Formatter::Include runs at 6) sub format_content { my ($class, $content, $c) = @_; $$content =~ s/fuck/f**k/g; return $content; } DESCRIPTIONThis is the class to inherit from if you want to write your own formatter.WRITING YOUR OWN FORMATTERSee the synopsis for a really simple formatter example. MojoMojo uses Module::Pluggable::Ordered to process all the formatter plugins. Just specify when you want to trigger your formatter by providing a format_content_order method which returns a number to specify when you want to run. The plugin order for the default plugins is currently as follows:
Note that if your formatter expects HTML text, it should run after the main formatter. METHODSformat_contentIf you want your formatter to do something, you also need to override "format_content". It gets passed its classname, a scalar ref to the content, and the context object. It should return the scalar ref.main_format_contentOverride this method if your formatter is a primary one (equivalent to Markdown or Textile). It gets passed the same arguments as "format_content". Also make sure to update "Site settings" (/.admin).Note that the main formatter runs at 15. module_loadedReturn true if a formatter module is loaded.gen_regen_re(qr/irc/) Returns a regular expression for the given tag between matching double braces. SEE ALSOMojoMojo, MojoMojo::Formatter::Textile, MojoMojo::Formatter::MarkdownAUTHORSMarcus Ramberg <mramberg@cpan.org>LICENSEThis library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |