line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdown::Pod; |
2
|
|
|
|
|
|
|
# ABSTRACT: Convert Markdown to POD |
3
|
|
|
|
|
|
|
|
4
|
32
|
|
|
32
|
|
3460498
|
use strict; |
|
32
|
|
|
|
|
360
|
|
|
32
|
|
|
|
|
849
|
|
5
|
32
|
|
|
32
|
|
156
|
use warnings; |
|
32
|
|
|
|
|
69
|
|
|
32
|
|
|
|
|
1180
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.008'; |
8
|
|
|
|
|
|
|
|
9
|
32
|
|
|
32
|
|
779
|
use Encode qw( encodings ); |
|
32
|
|
|
|
|
10607
|
|
|
32
|
|
|
|
|
1305
|
|
10
|
32
|
|
|
32
|
|
177
|
use List::Util qw( first ); |
|
32
|
|
|
|
|
53
|
|
|
32
|
|
|
|
|
1773
|
|
11
|
32
|
|
|
32
|
|
14423
|
use Markdent::Parser; |
|
32
|
|
|
|
|
109597535
|
|
|
32
|
|
|
|
|
1574
|
|
12
|
32
|
|
|
32
|
|
284
|
use Markdent::Types qw( Str ); |
|
32
|
|
|
|
|
70
|
|
|
32
|
|
|
|
|
278
|
|
13
|
32
|
|
|
32
|
|
795463
|
use Markdown::Pod::Handler; |
|
32
|
|
|
|
|
113
|
|
|
32
|
|
|
|
|
1472
|
|
14
|
32
|
|
|
32
|
|
272
|
use Moose; |
|
32
|
|
|
|
|
54
|
|
|
32
|
|
|
|
|
221
|
|
15
|
32
|
|
|
32
|
|
205594
|
use MooseX::Params::Validate qw( validated_list ); |
|
32
|
|
|
|
|
73
|
|
|
32
|
|
|
|
|
291
|
|
16
|
32
|
|
|
32
|
|
6934
|
use MooseX::StrictConstructor; |
|
32
|
|
|
|
|
61
|
|
|
32
|
|
|
|
|
265
|
|
17
|
32
|
|
|
32
|
|
109079
|
use namespace::autoclean; |
|
32
|
|
|
|
|
72
|
|
|
32
|
|
|
|
|
248
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub markdown_to_pod { |
20
|
31
|
|
|
31
|
1
|
4886
|
my $self = shift; |
21
|
31
|
|
|
|
|
437
|
my ( $dialect, $markdown, $encoding ) = validated_list( |
22
|
|
|
|
|
|
|
\@_, |
23
|
|
|
|
|
|
|
dialect => { type => 'Str', default => 'Standard', optional => 1 }, |
24
|
|
|
|
|
|
|
markdown => { type => 'Str' }, |
25
|
|
|
|
|
|
|
encoding => { type => 'Str', default => q{}, optional => 1 }, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
31
|
|
|
|
|
6219
|
my $capture = q{}; |
29
|
31
|
50
|
|
31
|
|
1147
|
open my $fh, '>', \$capture |
|
31
|
|
|
|
|
243
|
|
|
31
|
|
|
|
|
55
|
|
|
31
|
|
|
|
|
212
|
|
30
|
|
|
|
|
|
|
or die $!; |
31
|
|
|
|
|
|
|
|
32
|
31
|
50
|
|
|
|
24843
|
if ($encoding) { |
33
|
31
|
|
|
217
|
|
362
|
my $found = first { $_ eq $encoding } Encode->encodings; |
|
217
|
|
|
|
|
8103
|
|
34
|
31
|
50
|
|
|
|
193
|
if ($found) { |
35
|
31
|
|
|
31
|
|
784
|
binmode $fh, ":encoding($encoding)"; |
|
31
|
|
|
|
|
202
|
|
|
31
|
|
|
|
|
61
|
|
|
31
|
|
|
|
|
167
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
0
|
|
|
|
|
0
|
warn "cannot find such '$encoding' encoding\n"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
31
|
|
|
|
|
28636
|
my $handler = Markdown::Pod::Handler->new( |
43
|
|
|
|
|
|
|
encoding => $encoding, |
44
|
|
|
|
|
|
|
output => $fh, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
31
|
|
|
|
|
1068
|
my $parser = Markdent::Parser->new( |
48
|
|
|
|
|
|
|
dialect => $dialect, |
49
|
|
|
|
|
|
|
handler => $handler, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
31
|
|
|
|
|
78632
|
$parser->parse( markdown => $markdown ); |
53
|
|
|
|
|
|
|
|
54
|
31
|
|
|
|
|
1847
|
close $fh; |
55
|
|
|
|
|
|
|
|
56
|
31
|
|
|
|
|
2882
|
$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
|
31
|
|
|
|
|
1532
|
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.008 |
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) Dave Rolsky (DROLSKY) Jason McIntosh (JMAC) Ji-Hyeon Gim (POTATOGIM) Slaven Rezić (SREZIC) Zakariyya Mughal (ZMUGHAL) |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=over 4 |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Andrew Speer (ASPEER) <andrew@webdyne.org> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Dave Rolsky (DROLSKY) <autarch@urth.org> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Jason McIntosh (JMAC) <jmac@jmac.org> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Ji-Hyeon Gim (POTATOGIM) <potatogim@potatogim.net> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Slaven Rezić (SREZIC) <slaven@rezic.de> |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item * |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Zakariyya Mughal (ZMUGHAL) <zmughal@cpan.org> |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=back |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Keedi Kim. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
211
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |