|
NAMEText::HikiDoc - Pure Perl implementation of 'HikiDoc' which is a text-to-HTML conversion tool.SYNOPSISuse Text::HikiDoc; # $text = '!Title'; # $html = '<h1>Title</h1>'; $obj = Text::HikiDoc->new(); $html = $obj->to_html($text); or $obj = Text::HikiDoc->new($text); $html = $obj->to_html(); # $text = "!Title\n----\n!!SubTitle"; # $html = "<h2>Title</h2>\n<hr />\n<h3>SubTitle</h3>\n"; $obj = Text::HikiDoc->new({ string => $text, level => 2, empty_element_suffix => ' />', br_mode => 'true', table_border => 'false', }); or $obj = Text::HikiDoc->new($text, 2, ' />', 'true', 'false'); $html = $obj->to_html(); # $text = "!Title\n----\n!!SubTitle\nhogehoge{{br}}fugafuga"; # $html = "<h1>Title</h1>\n<hr />\n<h2>SubTitle</h2>\n<p>hogehoge<br />fugafuga</p>\n"; $obj = Text::HikiDoc->new(); $obj->enable_plugin('br'); $html = $obj->to_html($text); $obj->enable_plugin('br','ins'); @plugins = $obj->plugin_list; # br, ins $obj->is_enabled('br'); # 1 $obj->is_enabled('pr'); # 0 DESCRIPTION'HikiDoc' is a text-to-HTML conversion tool for web writers. The original 'HikiDoc' is Ruby implementation.This library is pure perl implementation of 'HikiDoc', and has interchangeability with the original. MethodsnewThis method creates a new HikiDoc object. The following
parameters are accepted.
to_htmlThis method converts string to html
enable_plugin(@args)This method enables plugin module. '@args' is list of
plugin names.
plugin_listThis method returns array of enabled plugin lists.
is_enabled($str)This method returns 1 or 0. If enabled plugin
"$str", return 1.
PluginText::HikiDoc can be enhanced by the plug-in. When you use the plug-in, enable_plugin() is used.Text::HikiDoc::Plugin::aa{{aa " (__) (oo) /-------\/ / | || * ||----|| ~~ ~~ "}} is replaced with <pre class="ascii-art"> (__) (oo) /-------\/ / | || * ||----|| ~~ ~~ </pre> If Text::HikiDoc::Plugin::texthighlight or Text::HikiDoc::Plugin::vimcolor is enabled, you can write <<< aa (__) (oo) /-------\/ / | || * ||----|| ~~ ~~ >>> Text::HikiDoc::Plugin::br{{br}}
is replaced with <br /> Text::HikiDoc::Plugin::e{{e('hearts')}} {{e('9829')}}
is replaced with ♥ ♥ Text::HikiDoc::Plugin::ins{{ins 'insert part'}}
is replaced with <ins>insert part</ins> Text::HikiDoc::Plugin::subH{{sub('2')}}O
is replaced with H<sub>2</sub>O Text::HikiDoc::Plugin::sup2{{sup(3)}}=8
is replaced with 2<sup>3</sup>=8 Text::HikiDoc::Plugin::texthighlightSyntax color text is added to the pre mark. That uses
Text::Highlight .
The following, it is highlighted as the source code of Perl. When writing instead of"<<< Perl" as "<<<", it becomes a usual pre mark. <<< Perl sub dummy { $string = shift; $string =~ /$PLUGIN_RE/; print "s:$string\tm:$1\ta:$2\n"; $a = $2; $a =~ s/^\s*(.*)\s*$/$1/; if ( $a =~ /($PLUGIN_RE)/ ) { &hoge($a); } return $string; } >>> NOTE: Method of mounting this plug-in will change in the future. Text::HikiDoc::Plugin::vimcolorSyntax color text is added to the pre mark. That uses
Text::VimColor .
NOTE: Method of mounting this plug-in will change in the future. SEE ALSO
AUTHORSThe original 'HikiDoc' was written by Kazuhiko <kazuhiko@fdiary.net>This release was made by Kawabata, Kazumichi (Higemaru) <kawabata@cpan.org> http://haro.jp/ COPYRIGHT AND LICENSEThis library 'HikiDoc.pm' is free software; you can redistribute it and/or modify it under the same terms as Perl itself.Copyright (C) 2006- Kawabata, Kazumichi (Higemaru) <kawabata@cpan.org>
Visit the GSP FreeBSD Man Page Interface. |