Text::CaffeinatedMarkup::HTMLFormatter - HTML formatter for the Caffeinated Markup Language
use Text::CaffeinatedMarkup::HTMLFormatter; my $formatter = Text::CaffeinatedMarkup::HTMLFormatter->new; my $to_format = 'Some **stuff** to be //parsed//'; my $html = $formatter->format($to_format);
Provides formatting to HTML for the Caffeinated Markup Language. Implemented using the Text::CaffeinatedMarkup::PullParser.
For details on the syntax that CML implements, please see the Github wiki.
This module provides the following methods.
my $html = $formatter->format( 'something to format' );
Takes a raw string in Caffeinated Markup format and returns a string of encoded HTML.
The various markup elements are mapped to HTML by this formatter as follows.
**foo** -> <strong>foo</strong>
//foo// -> <em>foo</em>
__foo__ -> <u>foo</u>
--foo-- -> <del>foo</del>
~~ -> <hr>
""foo"" -> <blockquote>foo</blockquote> ""foo|bar"" -> <blockquote>foo<cite>bar</cite></blockquote>
# foo -> <h1>foo</h1> ## foo -> <h2>foo</h2> ### foo -> <h3>foo</h3>
[[http://www.google.com]] -> <a href="http://www.google.com">http://www.google.com</a> [[http://www.google.com|google]] -> <a href="http://www.google.com">google</a>
{{foo.jpg}} -> <img src="foo.jpg"> {{foo.jpg|<<,H10,W10}} -> <img src="foo.jpg" class="pulled-left" width="10px" height="10px">
\n -> <br> \n\n -> <p> # (3+ \n still becomes single <p>)
==\n||foo\n||bar\n== -> <div class="clearfix col-2"> <div class="column">foo</div> <div class="column">bar</div> </div>
The Github wiki
J Gregory <jgregory@cpan.org>
To install Text::CaffeinatedMarkup::PullParser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::CaffeinatedMarkup::PullParser
CPAN shell
perl -MCPAN -e shell install Text::CaffeinatedMarkup::PullParser
For more information on module installation, please visit the detailed CPAN module installation guide.