line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdown::Pod; |
2
|
|
|
|
|
|
|
# ABSTRACT: Convert Markdown to POD |
3
|
|
|
|
|
|
|
|
4
|
31
|
|
|
31
|
|
870496
|
use strict; |
|
31
|
|
|
|
|
68
|
|
|
31
|
|
|
|
|
1016
|
|
5
|
31
|
|
|
31
|
|
144
|
use warnings; |
|
31
|
|
|
|
|
42
|
|
|
31
|
|
|
|
|
1262
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
8
|
|
|
|
|
|
|
|
9
|
31
|
|
|
31
|
|
601
|
use Encode qw( encodings ); |
|
31
|
|
|
|
|
7589
|
|
|
31
|
|
|
|
|
1308
|
|
10
|
31
|
|
|
31
|
|
145
|
use List::Util qw( first ); |
|
31
|
|
|
|
|
39
|
|
|
31
|
|
|
|
|
2805
|
|
11
|
31
|
|
|
31
|
|
14666
|
use Markdent::Parser; |
|
31
|
|
|
|
|
88079929
|
|
|
31
|
|
|
|
|
1493
|
|
12
|
31
|
|
|
31
|
|
259
|
use Markdent::Types qw( Str ); |
|
31
|
|
|
|
|
50
|
|
|
31
|
|
|
|
|
217
|
|
13
|
31
|
|
|
31
|
|
148705
|
use Markdown::Pod::Handler; |
|
31
|
|
|
|
|
114
|
|
|
31
|
|
|
|
|
1282
|
|
14
|
31
|
|
|
31
|
|
255
|
use Moose; |
|
31
|
|
|
|
|
48
|
|
|
31
|
|
|
|
|
196
|
|
15
|
31
|
|
|
31
|
|
165429
|
use MooseX::Params::Validate qw( validated_list ); |
|
31
|
|
|
|
|
62
|
|
|
31
|
|
|
|
|
312
|
|
16
|
31
|
|
|
31
|
|
5780
|
use MooseX::StrictConstructor; |
|
31
|
|
|
|
|
56
|
|
|
31
|
|
|
|
|
324
|
|
17
|
31
|
|
|
31
|
|
79989
|
use namespace::autoclean; |
|
31
|
|
|
|
|
65
|
|
|
31
|
|
|
|
|
213
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub markdown_to_pod { |
20
|
30
|
|
|
30
|
1
|
10042
|
my $self = shift; |
21
|
30
|
|
|
|
|
256
|
my ( $dialect, $markdown, $encoding ) = validated_list( |
22
|
|
|
|
|
|
|
\@_, |
23
|
|
|
|
|
|
|
dialect => { isa => Str, default => 'Standard', optional => 1 }, |
24
|
|
|
|
|
|
|
markdown => { isa => Str }, |
25
|
|
|
|
|
|
|
encoding => { isa => Str, default => q{}, optional => 1 }, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
30
|
|
|
|
|
123055
|
my $capture = q{}; |
29
|
30
|
50
|
|
30
|
|
1264
|
open my $fh, '>', \$capture |
|
30
|
|
|
|
|
225
|
|
|
30
|
|
|
|
|
123
|
|
|
30
|
|
|
|
|
238
|
|
30
|
|
|
|
|
|
|
or die $!; |
31
|
|
|
|
|
|
|
|
32
|
30
|
50
|
|
|
|
28184
|
if ($encoding) { |
33
|
30
|
|
|
180
|
|
379
|
my $found = first { $_ eq $encoding } Encode->encodings; |
|
180
|
|
|
|
|
6098
|
|
34
|
30
|
50
|
|
|
|
176
|
if ($found) { |
35
|
30
|
|
|
30
|
|
631
|
binmode $fh, ":encoding($encoding)"; |
|
30
|
|
|
|
|
156
|
|
|
30
|
|
|
|
|
42
|
|
|
30
|
|
|
|
|
138
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
0
|
|
|
|
|
0
|
warn "cannot find such '$encoding' encoding\n"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
30
|
|
|
|
|
27158
|
my $handler = Markdown::Pod::Handler->new( |
43
|
|
|
|
|
|
|
encoding => $encoding, |
44
|
|
|
|
|
|
|
output => $fh, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
30
|
|
|
|
|
948
|
my $parser = Markdent::Parser->new( |
48
|
|
|
|
|
|
|
dialect => $dialect, |
49
|
|
|
|
|
|
|
handler => $handler, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
30
|
|
|
|
|
70914
|
$parser->parse( markdown => $markdown ); |
53
|
|
|
|
|
|
|
|
54
|
30
|
|
|
|
|
2031
|
close $fh; |
55
|
|
|
|
|
|
|
|
56
|
30
|
|
|
|
|
2470
|
$capture =~ s/\n+$/\n/; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# FIXME |
60
|
|
|
|
|
|
|
# dirty code to support blockquote |
61
|
|
|
|
|
|
|
# |
62
|
|
|
|
|
|
|
# UPDATE A.Speer - not needed, blockquote converted to use =over 2, =back |
63
|
|
|
|
|
|
|
# |
64
|
|
|
|
|
|
|
#$capture =~ s{ |
65
|
|
|
|
|
|
|
# ^ =begin \s+ blockquote |
66
|
|
|
|
|
|
|
# \s+ |
67
|
|
|
|
|
|
|
# (.*?) |
68
|
|
|
|
|
|
|
# \s+ |
69
|
|
|
|
|
|
|
# ^ =end \s+ blockquote |
70
|
|
|
|
|
|
|
#}{ |
71
|
|
|
|
|
|
|
# my $quoted = $1; |
72
|
|
|
|
|
|
|
# $quoted =~ s/^/ /gsm; |
73
|
|
|
|
|
|
|
# $quoted; |
74
|
|
|
|
|
|
|
#}xgsme; |
75
|
|
|
|
|
|
|
|
76
|
30
|
|
|
|
|
1334
|
return $capture; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=encoding UTF-8 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Markdown::Pod - Convert Markdown to POD |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 VERSION |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
version 0.006 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SYNOPSIS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
use Markdown::Pod; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $m2p = Markdown::Pod->new; |
101
|
|
|
|
|
|
|
my $pod = $m2p->markdown_to_pod( |
102
|
|
|
|
|
|
|
markdown => $markdown, |
103
|
|
|
|
|
|
|
); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 DESCRIPTION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This module parses Markdown text and return POD text. |
108
|
|
|
|
|
|
|
It uses L<Markdent> module to parse Markdown. |
109
|
|
|
|
|
|
|
Due to POD doesn't support blockquoted HTML tag, |
110
|
|
|
|
|
|
|
so quoted text of Markdown will not be handled properly. |
111
|
|
|
|
|
|
|
Quoted text will be converted to POD verbatim section. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 markdown |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
markdown text |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 encoding |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
encoding to use. Available type of encoding is same as L<Encode> module. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 METHODS |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 new |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
create Markdown::Pod object |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 markdown_to_pod |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
convert markdown text to POD text |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 SEE ALSO |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=over |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
L<Markdent> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
L<Pod::Markdown> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
L<Text::MultiMarkdown>, L<Text::Markdown> |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=back |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 SUPPORT |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
158
|
|
|
|
|
|
|
at L<https://github.com/keedi/Markdown-Pod/issues>. |
159
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 Source Code |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
164
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L<https://github.com/keedi/Markdown-Pod> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
git clone https://github.com/keedi/Markdown-Pod.git |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 AUTHOR |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
ê¹ëí - Keedi Kim <keedi@cpan.org> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=for stopwords Andrew Speer (ASPEER) Jason McIntosh (JMAC) Zakariyya Mughal (ZMUGHAL) |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=over 4 |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Andrew Speer (ASPEER) <andrew@webdyne.org> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Jason McIntosh (JMAC) <jmac@jmac.org> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Zakariyya Mughal (ZMUGHAL) <zmughal@cpan.org> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=back |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Keedi Kim. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
199
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=cut |