line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Dialect::GitHub::SpanParser; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2166
|
use strict; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
128
|
|
4
|
4
|
|
|
4
|
|
25
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
112
|
|
5
|
4
|
|
|
4
|
|
22
|
use namespace::autoclean; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
26
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.38'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
325
|
use Markdent::Event::AutoLink; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
120
|
|
10
|
4
|
|
|
4
|
|
29
|
use Markdent::Event::LineBreak; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
128
|
|
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
34
|
use Moose::Role; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
32
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Markdent::Role::Dialect::SpanParser'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _build_emphasis_start_delimiter_re { |
17
|
18
|
|
|
18
|
|
37
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
18
|
|
|
|
|
554
|
return qr/(?:\*|(?<=\W)_|(?<=^)_)/; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
23
|
|
|
|
|
|
|
sub _emphasis_end_delimiter_re { |
24
|
10
|
|
|
10
|
|
18
|
my $self = shift; |
25
|
10
|
|
|
|
|
27
|
my $delim = shift; |
26
|
|
|
|
|
|
|
|
27
|
10
|
100
|
|
|
|
106
|
return $delim eq '*' ? qr/\Q$delim\E/ : qr/\Q$delim\E(?=$|\W)/; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
## use critic |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
around _possible_span_matches => sub { |
32
|
|
|
|
|
|
|
my $orig = shift; |
33
|
|
|
|
|
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my @look_for = $self->$orig(); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my %open = $self->_open_start_events_for_span( 'code', 'link' ); |
38
|
|
|
|
|
|
|
return @look_for |
39
|
|
|
|
|
|
|
if keys %open; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return ( |
42
|
|
|
|
|
|
|
$self->$orig(), |
43
|
|
|
|
|
|
|
'bare_link', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
48
|
|
|
|
|
|
|
sub _match_bare_link { |
49
|
54
|
|
|
54
|
|
120
|
my $self = shift; |
50
|
54
|
|
|
|
|
85
|
my $text = shift; |
51
|
|
|
|
|
|
|
|
52
|
54
|
100
|
|
|
|
72
|
return unless ${$text} =~ m{ \G |
|
54
|
|
|
|
|
283
|
|
53
|
|
|
|
|
|
|
(?: |
54
|
|
|
|
|
|
|
(?<=^) |
55
|
|
|
|
|
|
|
| |
56
|
|
|
|
|
|
|
(?<=\W) |
57
|
|
|
|
|
|
|
) |
58
|
|
|
|
|
|
|
( |
59
|
|
|
|
|
|
|
https? |
60
|
|
|
|
|
|
|
:// |
61
|
|
|
|
|
|
|
\S+ |
62
|
|
|
|
|
|
|
) |
63
|
|
|
|
|
|
|
}xgc; |
64
|
|
|
|
|
|
|
|
65
|
5
|
|
|
|
|
22
|
my $link = $self->_make_event( AutoLink => uri => $1 ); |
66
|
|
|
|
|
|
|
|
67
|
5
|
|
|
|
|
21
|
$self->_markup_event($link); |
68
|
|
|
|
|
|
|
|
69
|
5
|
|
|
|
|
22
|
return 1; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
## use critic |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
around _text_end_res => sub { |
74
|
|
|
|
|
|
|
my $orig = shift; |
75
|
|
|
|
|
|
|
my $self = shift; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
return ( |
78
|
|
|
|
|
|
|
$self->$orig(), |
79
|
|
|
|
|
|
|
qr{https?://}, |
80
|
|
|
|
|
|
|
); |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# ABSTRACT: Span parser for GitHub Markdown |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=pod |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=encoding UTF-8 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 NAME |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Markdent::Dialect::GitHub::SpanParser - Span parser for GitHub Markdown |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 VERSION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
version 0.38 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 DESCRIPTION |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This role adds parsing for some of the Markdown extensions used on GitHub. See |
104
|
|
|
|
|
|
|
http://github.github.com/github-flavored-markdown/ for details. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 ROLES |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This role does the L<Markdent::Role::Dialect::SpanParser> role. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 BUGS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
See L<Markdent> for bug reporting details. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SOURCE |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Dave Rolsky. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
131
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
The full text of the license can be found in the |
134
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |