line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Role::Simple; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2278
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
102
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
88
|
|
5
|
3
|
|
|
3
|
|
18
|
use namespace::autoclean; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
23
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.40'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
274
|
use Encode qw( decode ); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
161
|
|
10
|
3
|
|
|
3
|
|
551
|
use Markdent::Parser; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
83
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
22
|
use Moose::Role; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
28
|
|
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
|
|
8
|
my $self = shift; |
31
|
3
|
|
|
|
|
9
|
my $markdown = shift; |
32
|
3
|
|
|
|
|
8
|
my $dialects = shift; |
33
|
3
|
|
|
|
|
19
|
my $handler_class = shift; |
34
|
3
|
|
|
|
|
8
|
my $handler_p = shift; |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
7
|
my $capture = q{}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
## no critic (InputOutput::RequireBriefOpen) |
39
|
3
|
50
|
|
3
|
|
32
|
open my $fh, '>:encoding(UTF-8)', \$capture |
|
3
|
|
|
3
|
|
8
|
|
|
3
|
|
|
|
|
25
|
|
|
3
|
|
|
|
|
2331
|
|
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
98
|
|
40
|
|
|
|
|
|
|
or die $!; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $handler = $handler_class->new( |
43
|
3
|
100
|
|
|
|
3184
|
%{ $handler_p || {} }, |
|
3
|
|
|
|
|
153
|
|
44
|
|
|
|
|
|
|
output => $fh, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
101
|
my $parser |
48
|
|
|
|
|
|
|
= Markdent::Parser->new( dialects => $dialects, handler => $handler ); |
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
21
|
$parser->parse( markdown => $markdown ); |
51
|
|
|
|
|
|
|
|
52
|
3
|
50
|
|
|
|
90
|
close $fh |
53
|
|
|
|
|
|
|
or die $!; |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
24
|
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.40 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 DESCRIPTION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This role implements behavior shared by all simple markdown to html converters. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 REQUIRED METHODS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 4 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * $simple->markdown_to_html(%p); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 BUGS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
See L<Markdent> for bug reporting details. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SOURCE |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Dave Rolsky. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The full text of the license can be found in the |
112
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |