line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Role::Simple; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2325
|
use strict; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
143
|
|
4
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
91
|
|
5
|
3
|
|
|
3
|
|
17
|
use namespace::autoclean; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
25
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.38'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
275
|
use Encode qw( decode ); |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
162
|
|
10
|
3
|
|
|
3
|
|
436
|
use Markdent::Parser; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
106
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
23
|
use Moose::Role; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
30
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
requires 'markdown_to_html'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around markdown_to_html => sub { |
17
|
|
|
|
|
|
|
my $orig = shift; |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
my %p = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# XXX - should warn eventually. |
22
|
|
|
|
|
|
|
$p{dialects} = delete $p{dialect} |
23
|
|
|
|
|
|
|
if exists $p{dialect}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return $self->$orig(%p); |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
29
|
|
|
|
|
|
|
sub _parse_markdown { |
30
|
3
|
|
|
3
|
|
9
|
my $self = shift; |
31
|
3
|
|
|
|
|
7
|
my $markdown = shift; |
32
|
3
|
|
|
|
|
8
|
my $dialects = shift; |
33
|
3
|
|
|
|
|
8
|
my $handler_class = shift; |
34
|
3
|
|
|
|
|
9
|
my $handler_p = shift; |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
8
|
my $capture = q{}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
## no critic (InputOutput::RequireBriefOpen) |
39
|
3
|
50
|
|
3
|
|
26
|
open my $fh, '>:encoding(UTF-8)', \$capture |
|
3
|
|
|
3
|
|
8
|
|
|
3
|
|
|
|
|
25
|
|
|
3
|
|
|
|
|
2298
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
101
|
|
40
|
|
|
|
|
|
|
or die $!; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $handler = $handler_class->new( |
43
|
3
|
100
|
|
|
|
3147
|
%{ $handler_p || {} }, |
|
3
|
|
|
|
|
175
|
|
44
|
|
|
|
|
|
|
output => $fh, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
105
|
my $parser |
48
|
|
|
|
|
|
|
= Markdent::Parser->new( dialects => $dialects, handler => $handler ); |
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
29
|
$parser->parse( markdown => $markdown ); |
51
|
|
|
|
|
|
|
|
52
|
3
|
50
|
|
|
|
81
|
close $fh |
53
|
|
|
|
|
|
|
or die $!; |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
28
|
return decode( 'UTF-8', $capture ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# ABSTRACT: A role for simple markdown to html converter classes |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=pod |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=encoding UTF-8 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Markdent::Role::Simple - A role for simple markdown to html converter classes |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
version 0.38 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 DESCRIPTION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This role implements behavior shared by all simple markdown to html |
79
|
|
|
|
|
|
|
converters. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 REQUIRED METHODS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * $simple->markdown_to_html(%p); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 BUGS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
See L<Markdent> for bug reporting details. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SOURCE |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Dave Rolsky. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
110
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
The full text of the license can be found in the |
113
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |