line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Dialect::GitHub::BlockParser; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2489
|
use strict; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
132
|
|
4
|
4
|
|
|
4
|
|
25
|
use warnings; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
118
|
|
5
|
4
|
|
|
4
|
|
21
|
use namespace::autoclean; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
34
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.38'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
2121
|
use Markdent::Event::CodeBlock; |
|
4
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
178
|
|
10
|
4
|
|
|
4
|
|
1356
|
use Markdent::Regexes qw( $BlockStart $HorizontalWS ); |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
591
|
|
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
30
|
use Moose::Role; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
41
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Markdent::Role::Dialect::BlockParser'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around _possible_block_matches => sub { |
17
|
|
|
|
|
|
|
my $orig = shift; |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @look_for = $self->$orig(); |
21
|
|
|
|
|
|
|
unshift @look_for, 'fenced_code_block'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return @look_for; |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
27
|
|
|
|
|
|
|
sub _match_fenced_code_block { |
28
|
36
|
|
|
36
|
|
68
|
my $self = shift; |
29
|
36
|
|
|
|
|
57
|
my $text = shift; |
30
|
|
|
|
|
|
|
|
31
|
36
|
100
|
|
|
|
56
|
return unless ${$text} =~ / \G |
|
36
|
|
|
|
|
486
|
|
32
|
|
|
|
|
|
|
$BlockStart |
33
|
|
|
|
|
|
|
``` |
34
|
|
|
|
|
|
|
$HorizontalWS?\{?\.?([\w-]+)?\}?$HorizontalWS* # optional language name |
35
|
|
|
|
|
|
|
\n |
36
|
|
|
|
|
|
|
( # code block content |
37
|
|
|
|
|
|
|
(?:.|\n)+? |
38
|
|
|
|
|
|
|
) |
39
|
|
|
|
|
|
|
\n |
40
|
|
|
|
|
|
|
``` |
41
|
|
|
|
|
|
|
\n |
42
|
|
|
|
|
|
|
/xmgc; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
23
|
my $lang = $1; |
45
|
7
|
|
|
|
|
14
|
my $code = $2; |
46
|
|
|
|
|
|
|
|
47
|
7
|
0
|
|
|
|
198
|
$self->_debug_parse_result( |
|
|
50
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$code, |
49
|
|
|
|
|
|
|
'code block', |
50
|
|
|
|
|
|
|
( $lang ? [ language => $lang ] : () ), |
51
|
|
|
|
|
|
|
) if $self->debug(); |
52
|
|
|
|
|
|
|
|
53
|
7
|
100
|
|
|
|
37
|
$self->_send_event( |
54
|
|
|
|
|
|
|
'CodeBlock', |
55
|
|
|
|
|
|
|
code => $code, |
56
|
|
|
|
|
|
|
( defined $lang ? ( language => $lang ) : () ), |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
7
|
|
|
|
|
788
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
## use critic |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# ABSTRACT: Block parser for GitHub Markdown |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding UTF-8 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Markdent::Dialect::GitHub::BlockParser - Block parser for GitHub Markdown |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 VERSION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
version 0.38 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This role adds parsing for some of the Markdown extensions used on GitHub. See |
84
|
|
|
|
|
|
|
http://github.github.com/github-flavored-markdown/ for details. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 ROLES |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This role does the L<Markdent::Role::Dialect::BlockParser> role. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 BUGS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
See L<Markdent> for bug reporting details. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SOURCE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Dave Rolsky. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
111
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
The full text of the license can be found in the |
114
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |