public
Description: TT plugin for Text::Hatena
Clone URL: git://github.com/naoya/perl-template-plugin-hatena.git
support Text::Hatena 0.20
naoya (author)
Wed Jun 11 22:42:32 -0700 2008
commit  24e4bb175b75a468f410cec4ae9f95e7b7e65eb4
tree    a910610d50939a518125dec90dd8493706a99090
parent  5bceec96462d2830301f3db4306018f7a1ac5f54
...
1
2
 
 
 
3
4
5
...
1
2
3
4
5
6
7
8
0
@@ -1,5 +1,8 @@
0
 Revision history for Perl extension Template::Plugin::Hatena.
0
 
0
+0.02 Thu Jul 12
0
+ - support Text::Hatena 0.20
0
+
0
 0.01 Thu Sep 29 20:02:56 2005
0
   - original version; created by h2xs 1.23 with options
0
     -X -A -n Template::Plugin::Hatena
...
3
4
5
6
7
 
 
8
9
10
...
3
4
5
 
 
6
7
8
9
10
0
@@ -3,8 +3,8 @@ WriteMakefile(
0
     NAME => 'Template::Plugin::Hatena',
0
     VERSION_FROM => 'lib/Template/Plugin/Hatena.pm', # finds $VERSION
0
     PREREQ_PM => {
0
- Test::More => 0.32,
0
- Template => 2.08,
0
+ Test::More => 0.32,
0
+ Template => 2.08,
0
   Text::Hatena => 0.01,
0
     },
0
     ($] >= 5.005 ? ## Add these new keywords supported since 5.005
0
...
3
4
5
6
 
7
8
9
...
3
4
5
 
6
7
8
9
0
@@ -3,7 +3,7 @@ NAME
0
 
0
 SYNOPSIS
0
       [% USE Hatena -%]
0
- [% FILTER hatena permalink => 'http://www.example.com/entry/123' -%]
0
+ [% FILTER hatena -%]
0
       * Hello, World!
0
 
0
       - Good Morning
...
14
15
16
17
18
19
 
 
 
 
 
 
 
 
20
21
22
...
30
31
32
33
 
34
35
36
...
57
58
59
60
...
14
15
16
 
 
 
17
18
19
20
21
22
23
24
25
26
27
...
35
36
37
 
38
39
40
41
...
62
63
64
 
0
@@ -14,9 +14,14 @@ sub init {
0
 
0
 sub filter {
0
     my ($self, $text, $args, $config) = @_;
0
- my $parser = Text::Hatena->new(%$config);
0
- $parser->parse($text);
0
- return $parser->html;
0
+
0
+ if (Text::Hatena->VERSION >= 0.20) {
0
+ Text::Hatena->parse($text)
0
+ } else {
0
+ my $parser = Text::Hatena->new(%$config);
0
+ $parser->parse($text);
0
+ return $parser->html;
0
+ }
0
 }
0
 
0
 1;
0
@@ -30,7 +35,7 @@ Template::Plugin::Hatena - TT plugin for Text::Hatena
0
 =head1 SYNOPSIS
0
 
0
   [% USE Hatena -%]
0
- [% FILTER hatena permalink => 'http://www.example.com/entry/123' -%]
0
+ [% FILTER hatena -%]
0
   * Hello, World!
0
 
0
   - Good Morning
0
@@ -57,4 +62,3 @@ Naoya Ito E<lt>naoya@bloghackers.netE<gt>
0
 This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
0
 
0
 =cut
0
-
...
6
7
8
9
 
10
11
12
...
17
18
19
20
 
...
6
7
8
 
9
10
11
12
...
17
18
19
 
20
0
@@ -6,7 +6,7 @@ my $tt = Template->new;
0
 
0
 $tt->process(\<<EOF, {}, \my $out) or die $tt->error;
0
 [% USE Hatena -%]
0
-[% FILTER hatena sectionanchor => '\@' -%]
0
+[% FILTER hatena -%]
0
 * Hello
0
 
0
 -a
0
@@ -17,4 +17,4 @@ $tt->process(\<<EOF, {}, \my $out) or die $tt->error;
0
 [%- END %]
0
 EOF
0
 
0
-like $out, qr!<h3>.*?\<span class="sanchor">@</span>.*?Hello</h3>.*?<ul>.*?</ul>!s, $out;
0
+like $out, qr!<h3>.*?Hello</h3>.*?<ul>.*?</ul>!s;

Comments

    No one has commented yet.