NAME
Text::Xatena - Text-to-HTML converter with Xatena syntax.
SYNOPSIS
use Text::Xatena;
my $thx = Text::Xatena->new;
$thx->format($string);
# with some aggressive functions
my $thx = Text::Xatena->new(
inline => Text::Xatena::Inline::Aggressive->new(cache => Cache::MemoryCache->new)
);
$thx->format($string);
Customizing inline formatting rule
Text::Xatena->new(
inline => MyInline->new
)->format($string);
package MyInline;
use strict;
use warnings;
use Text::Xatena::Inline::Base -Base;
match qr{\@([a-z0-9]+)} => sub {
my ($self, $twitter_id) = @_;
sprintf('@%s',
$twitter_id,
$twitter_id,
);
};
1;
DESCRIPTION
Text::Xatena is a text-to-html converter.
Text::Xatena is comfortably to writing usual diary and blog, especially
for programmers, writers treating long text.
What is Xatena
Xatena syntax is similar to Hatena syntax (implemented as Text::Hatena),
but is independent from Hatena services and has more expandability.
Most block level syntax notations are supported and more compatibility
with Hatena::Diary than Text::Hatena 0.20.
And don't support rare syntax or what isn't to be done of syntax
formatter. (for example, linking keywords)
SYNTAX
Basically, Xatena convert single line breaks to "
and double line
breaks to "
element except "Stop P" syntax. fooo bar baz is converted to following:
fooo
bar
baz
Blockquote >> quoted text foobar << is converted to following:with cite >http://example.com/> foobar << is converted to following:quoted text
foobar
Pre >| pre formatted |< is converted to following:quote
http://example.com/
pre formattedSuper pre >|| super pre ||< is converted to following:
super pre <a>with lang >|perl| use Text::Xatena; ||< is converted to following:
use Text::Xatena;Stop P Stop insert p or br. >
< is converted to following:hogehoge br
< with custom block level element >< foobar >< is convert with auto inserting p tohogehoge br
foobar
Section Create structured sections by * following heading. * head1 foobar ** head2 *** head3 is converted to following:foobar
foo | bar | baz |
---|---|---|
test | test | test |
test | test | test |
block but Xatena
converts it to "
.
2. Hatena::Diary syntax converts * (heading notation) to simple "{{= $title }}
{{= $content }}