line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Provider::Markdown; |
2
|
2
|
|
|
2
|
|
99755
|
use 5.008; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
75
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
55
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
72
|
|
5
|
2
|
|
|
2
|
|
2234
|
use Text::Markdown 'markdown'; |
|
2
|
|
|
|
|
102736
|
|
|
2
|
|
|
|
|
168
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
19
|
use base qw( Template::Provider ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1356
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Template::Provider::Markdown - Markdown as template body, no HTML. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.05 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This module import Markdown syntax as the body of template. You don't live |
24
|
|
|
|
|
|
|
with HTML anymore. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Template; |
27
|
|
|
|
|
|
|
use Template::Provider::Markdown; |
28
|
|
|
|
|
|
|
my $tt = Template->new( |
29
|
|
|
|
|
|
|
LOAD_TEMPLATES => [ Template::Provider::Markdown->new ] |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
my $template = 'My name is [% author %]'; |
32
|
|
|
|
|
|
|
print $tt->process(\$template, { author => "Charlie" }); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
My name is Charlie |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 FUNCTIONS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 _load() |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This function is the entry point as a Template::Provider. You shouldn't call |
41
|
|
|
|
|
|
|
any functions in this module, but rather just use this module as the way in |
42
|
|
|
|
|
|
|
SYNOPSIS. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _load { |
47
|
1
|
|
|
1
|
|
31501
|
my $self = shift; |
48
|
1
|
|
|
|
|
10
|
my ($data, $error) = $self->SUPER::_load(@_); |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
34
|
$data->{text} = markdown($data->{text}); |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
2396
|
return ($data, $error); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Kang-min Liu, C<< >> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 BUGS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
62
|
|
|
|
|
|
|
C, or through the web interface at |
63
|
|
|
|
|
|
|
L. |
64
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
65
|
|
|
|
|
|
|
your bug as I make changes. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SUPPORT |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
perldoc Template::Provider::Markdown |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
You can also look for information at: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 4 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * CPAN Ratings |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * Search CPAN |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Copyright 2006,2007,2008,2009 Kang-min Liu, all rights reserved. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
100
|
|
|
|
|
|
|
under the same terms as Perl itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; # End of Template::Provider::Markdown |
105
|
|
|
|
|
|
|
|