Hatena::Formatter - converts text into html with almost Hatena style.
use Hatena::Formatter; my $formatter = Hatena::Formatter->new( text_config => {}, # set the Text::Hatena options. keyword_config => {}, # set the Hatena::Keyword options. ); $formatter->process($text); print $formatter->html;
Text::Hatena used generates html string with Hatena Style. and Hatena::Keyword used allows you to mark up a text as HTML with the Hatena keywords. When you want to adjust the option of Text::Hatena and Hatena::Keyword, it can be done.
In the process of each processing, it is also possible to do original processing hooking to process converted HTML.
$formatter = Hatena::Formatter->new( text_config => { hatenaid_href => '?id=%s' }, keyword_config => {}, );
creates an instance of Hatena::Formatter.
text_config is option that Text::Hatena uses. When this option is omitted, the processing of Text::Hatena is not executed.
text_config
hatenaid_href is Enhancing for Hatena::Formatter. The format of link href used by the id notation of Hatena is specified. id is substituted for %s. (It is possible to omit it. )
hatenaid_href
keyword_config is option that Hatena::Keyword uses. When this option is omitted, the processing of Hatena::Keyword is not executed.
keyword_config
$formatter2->register( hook => 'text_finalize', callback => sub { my($context, $option) = @_; } , option => {});
callback to do the hook in process is registered.
$formatter->process($text);
conversion processing.
$html = $formatter->html;
returns html string generated.
Kazuhiro Osawa <ko@yappo.ne.jp>
TransFreeBSD, Naoya Ito, otsune, tokuhirom
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Text::Hatena, Hatena::Keyword
To install Hatena::Formatter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hatena::Formatter
CPAN shell
perl -MCPAN -e shell install Hatena::Formatter
For more information on module installation, please visit the detailed CPAN module installation guide.