use File::Spec; use strict; use warnings; use Test::Base; use Text::Hatena; filters { text => ['text_hatena', 'omit_indent', 'chomp'], line => ['text_hatena_p', 'omit_indent', 'chomp'], html => ['omit_indent', 'chomp'], }; sub text_hatena { Text::Hatena->parse(shift, 'body') } sub text_hatena_p { Text::Hatena->parse(shift, 'p') } sub omit_indent { (my $text = shift) =~ s/^[\t\s]+//gmo; return $text; } #use Carp; #local $SIG{'__WARN__'} = \&Carp::confess; run_is; __END__ === h3 --- text *Hello, World! --- html

Hello, World!

=== h3_2 --- text *Hello, World! This is Text::Hatena. --- html

Hello, World!

This is Text::Hatena.

=== h3_3 --- text *Hello, World! This is Text::Hatena. --- html

*Hello, World!

This is Text::Hatena.

=== h3_4 --- text *Good morning It's morning. *Good afternoon Beautiful day! --- html

Good morning

It's morning.

Good afternoon

Beautiful day!

=== h4 --- text **Hello, Japan! This is Text::Hatena. --- html

Hello, Japan!

This is Text::Hatena.

=== h5 --- text ***Hello, Tokyo! This is Text::Hatena. --- html
Hello, Tokyo!

This is Text::Hatena.

=== blockquote --- text >> quoted << --- html

quoted

=== blockquote2 --- text >> quoted >> quoted quoted << << --- html

quoted

quoted quoted

=== blockquote3 --- text >> unquoted << --- html

>>

unquoted

<<

=== blockquote4 --- text >http://www.hatena.ne.jp/> Hatena << --- html

Hatena

http://www.hatena.ne.jp/
=== blockquote5 --- text >http://www.hatena.ne.jp/:title=Hatena> Hatena << --- html

Hatena

Hatena
=== dl --- text :cinnamon:dog --- html
cinnamon
dog
=== dl2 --- text :cinnamon:dog :tama:cat --- html
cinnamon
dog
tama
cat
=== ul --- text -komono -kyoto -shibuya --- html
=== ul2 --- text -komono --kyoto ---shibuya --hachiyama --- html
=== ul3 --- text -list --ul --ol -pre --- html
=== ul4 --- text - wrong list - what's happen? --- html

- wrong list

- what's happen?

=== ul5 --- text - right list - wrong list - what's happen? --- html

- wrong list

- what's happen?

=== ul6 --- text -Japan --Kyoto --Tokyo -USA --Mountain View --- html
=== ul7 --- text -komono --kyoto ---shibuya --hachiyama --- html
=== ol --- text +Register +Login +Write your blog --- html
  1. Register
  2. Login
  3. Write your blog
=== ol2 --- text -Steps ++Register ++Login ++Write your blog -Option --180pt --- html
=== super_pre --- text >|| #!/usr/bin/perl my $url = 'http://d.hatena.ne.jp/'; ||< --- html
#!/usr/bin/perl

my $url = 'http://d.hatena.ne.jp/';
=== super_pre_fail --- text >|| #!/usr/bin/perl my $name = 'jkondo'||< --- html

>||

#!/usr/bin/perl

my $name = 'jkondo'||<

=== super_pre2 --- text >|perl| #!/usr/bin/perl my $url = 'http://d.hatena.ne.jp/'; ||< --- html
#!/usr/bin/perl

my $url = 'http://d.hatena.ne.jp/';
=== super_pre3 --- text >|| >> unquoted << - unlisted http://www.hatena.com/ unanchored. ||< --- html
>>
unquoted
<<
- unlisted
http://www.hatena.com/ unanchored.
=== super_pre4 --- text >|| >> unquoted << - unlisted http://www.hatena.com/ unanchored. escaped tags ||< --- html
>>
unquoted
<<
- unlisted
http://www.hatena.com/ unanchored.
escaped tags
=== pre --- text >| #!/usr/bin/perl use strict; use warnings; say 'Hello, World!'; |< --- html
#!/usr/bin/perl
use strict;
use warnings;

say 'Hello, World!';
=== pre2 --- text >| To: info@test.com Subject: This is Test. Hello, This is test from Text::Hatena. Don't reply to this email. -- jkondo |< --- html
To: info@test.com
Subject: This is Test.

Hello, This is test from Text::Hatena.
 Don't reply to this email.

--
jkondo
=== table --- text |*Lang|*Module| |Perl|Text::Hatena| --- html
Lang Module
Perl Text::Hatena
=== cdata --- text >
no paragraph line
< paragraph line --- html
no paragraph line

paragraph line

=== cdata2 --- text >

Hello I am writing HTML tags by myself

< --- html

Hello I am writing HTML tags by myself

=== cdata3 --- text >
< Please add p tags for me. It's candy blockquote. >
< --- html

Please add p tags for me.

It's candy blockquote.

=== autolink --- text *Hello World! Here is Text::Hatena. CPAN site: http://search.cpan.org/dist/Text-Hatena/ Have fun! --- html

Hello World!

Here is Text::Hatena.

CPAN site: http://search.cpan.org/dist/Text-Hatena/

Have fun!