NAME
Hatena::Formatter - converts text into html with almost Hatena style.
SYNOPSIS
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;
DESCRIPTION
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.
METHODS
- new
-
$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.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. )keyword_config
is option that Hatena::Keyword uses. When this option is omitted, the processing of Hatena::Keyword is not executed. - register
-
$formatter2->register( hook => 'text_finalize', callback => sub { my($context, $option) = @_; } , option => {});
callback to do the hook in process is registered.
- process
-
$formatter->process($text);
conversion processing.
- html
-
$html = $formatter->html;
returns html string generated.
AUTHOR
Kazuhiro Osawa <ko@yappo.ne.jp>
THANKS TO
TransFreeBSD, Naoya Ito, otsune, tokuhirom
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.