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 $thx->format($string, inline => Text::Xatena::Inline::Aggressive->new(cache => Cache::MemoryCache->new) ); Customizing inline formatting rule Text::Xatena->new->format($string, inline => MyInline->new ); 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:

quoted text

foobar

with cite >http://example.com/> foobar << is converted to following:

quote

http://example.com/
Pre >| pre formatted |< is converted to following:
      pre formatted
      
Super 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. >

hogehoge br

< is converted to following:

hogehoge br

< with custom block level element >< foobar >< is convert with auto inserting p to

foobar

Section Create structured sections by * following heading. * head1 foobar ** head2 *** head3 is converted to following:

head1

foobar

head2

head3
List unordered list - ul - ul -- ul -- ul --- ul - ul is converted to following: ordered list + ol + ol ++ ol ++ ol +++ ol + ol is converted to following:
  1. ol
  2. ol
    1. ol
    2. ol
      1. ol
  3. ol
mixed list - ul - ul -+ ol -+ ol -+ ol - ul definition list :definition:description :definition:description is converted to following:
definition
description
definition
description
multiline This is incompatible syntax with Hatena::Diary :definition: :: description :definition: :: description Table |*foo|*bar|*baz| |test|test|test| |test|test|test| is converted to following:
foo bar baz
test test test
test test test
Inline syntax Autolink http:// ftp:// mailto:// http://example.com/ ftp://example.com/ mailto:cho45@lowreal.net [http://example.com/] # using Xatena::Inline::Aggressive [http://example.com/] [http://example.com/:title] # auto retrieving from url [http://example.com/:title=Foobar] [http://example.com/:barcode] # show qrcode with google chart API Deter inline syntax []http://example.com/[] Footnote syntax Perl((most famous light weight language)) is converted to Perl
*1 and footnote object is available in inline object, so you will do expand it like following: my $thx = Text::Xatena->new; my $inline = Text::Xatena::Inline->new; my $formatted = $thx->format('aaa((foobar)) bbb((barbaz))', inline => $inline); my $out = ''; $out .= '
'; $out .= $formatted; $out .= '
'; $out .= '
'; for my $footnote (@{ $inline->footnotes }) { $out .= sprintf('
*%d: %s
', $footnote->{number}, $footnote->{number}, $footnote->{note}, ); } $out .= '
'; Compatibility with Hatena::Diary syntax Some default behaviors of Xatena syntax are different from Hatena::Diary syntax. Big differences: 1. Hatena::Diary syntax converts single break to " block but Xatena converts it to "
. 2. Hatena::Diary syntax converts * (heading notation) to simple " element but Xatena converts it to "
3. Xatena support multiline definition list But Xatena supports Hatena::Diary compatible mode, you can change the behavior with a option. my $thx = Text::Xatena->new(hatena_compatible => 1); AUTHOR cho45 SEE ALSO Text::Hatena > LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.