line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
394
|
use 5.006; # our |
|
1
|
|
|
|
|
3
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
102
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package CPAN::Changes::Markdown; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Format your Changes file ( or a section of it ) in Markdown |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '1.000002'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
423
|
use Moo 1.000008 qw( has ); |
|
1
|
|
|
|
|
9909
|
|
|
1
|
|
|
|
|
6
|
|
14
|
1
|
|
|
|
|
4
|
use CPAN::Changes::Markdown::Filter::RuleUtil qw( |
15
|
|
|
|
|
|
|
rule_VersionsToCode |
16
|
|
|
|
|
|
|
rule_UnderscoredToCode |
17
|
|
|
|
|
|
|
rule_PackageNamesToCode |
18
|
1
|
|
|
1
|
|
1530
|
); |
|
1
|
|
|
|
|
1
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has changes => ( |
57
|
|
|
|
|
|
|
is => ro =>, |
58
|
|
|
|
|
|
|
lazy => 1, |
59
|
|
|
|
|
|
|
builder => sub { |
60
|
0
|
|
|
0
|
|
|
require CPAN::Changes; |
61
|
0
|
|
|
|
|
|
return CPAN::Changes->new(); |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has header_filter => ( |
72
|
|
|
|
|
|
|
is => ro =>, |
73
|
|
|
|
|
|
|
lazy => 1, |
74
|
|
|
|
|
|
|
builder => sub { |
75
|
0
|
|
|
0
|
|
|
require CPAN::Changes::Markdown::Filter; |
76
|
0
|
|
|
|
|
|
return CPAN::Changes::Markdown::Filter->new( rules => [ rule_VersionsToCode, rule_UnderscoredToCode ] ); |
77
|
|
|
|
|
|
|
}, |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
has line_filter => ( |
87
|
|
|
|
|
|
|
is => ro =>, |
88
|
|
|
|
|
|
|
lazy => 1, |
89
|
|
|
|
|
|
|
builder => sub { |
90
|
0
|
|
|
0
|
|
|
require CPAN::Changes::Markdown::Filter; |
91
|
0
|
|
|
|
|
|
return CPAN::Changes::Markdown::Filter->new( |
92
|
|
|
|
|
|
|
rules => [ rule_VersionsToCode, rule_UnderscoredToCode, rule_PackageNamesToCode ] ); |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub load { |
103
|
0
|
|
|
0
|
1
|
|
my ( $self, $path ) = @_; |
104
|
0
|
|
|
|
|
|
require CPAN::Changes; |
105
|
0
|
|
|
|
|
|
return $self->new( changes => CPAN::Changes->load($path) ); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub load_string { |
115
|
0
|
|
|
0
|
1
|
|
my ( $self, $string ) = @_; |
116
|
0
|
|
|
|
|
|
require CPAN::Changes; |
117
|
0
|
|
|
|
|
|
return $self->new( changes => CPAN::Changes->load_string($string) ); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub load_utf8 { |
129
|
0
|
|
|
0
|
1
|
|
my ( $self, $path ) = @_; |
130
|
0
|
|
|
|
|
|
require Path::Tiny; |
131
|
0
|
|
|
|
|
|
require CPAN::Changes; |
132
|
0
|
|
|
|
|
|
return $self->new( changes => CPAN::Changes->load_string( Path::Tiny::path($path)->slurp_utf8 ) ); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub _serialize_release { |
136
|
0
|
|
|
0
|
|
|
my ( $self, %args ) = @_; |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
my $release = delete $args{release}; |
139
|
0
|
|
|
|
|
|
my @output; |
140
|
|
|
|
|
|
|
|
141
|
0
|
0
|
|
|
|
|
push @output, sprintf q[## %s], ( join q[ ], grep { defined && length } ( $release->version, $release->date, $release->note ) ); |
|
0
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
for my $group ( $release->groups( sort => $args{group_sort} ) ) { |
144
|
0
|
0
|
|
|
|
|
if ( length $group ) { |
145
|
0
|
|
|
|
|
|
push @output, sprintf q[### %s], $self->header_filter->process($group); |
146
|
|
|
|
|
|
|
} |
147
|
0
|
|
|
|
|
|
for my $line ( @{ $release->changes($group) } ) { |
|
0
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
push @output, ' - ' . $self->line_filter->process($line); |
149
|
|
|
|
|
|
|
} |
150
|
0
|
|
|
|
|
|
push @output, q[]; |
151
|
|
|
|
|
|
|
} |
152
|
0
|
|
|
|
|
|
return @output; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub serialize { |
162
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
163
|
0
|
|
|
|
|
|
my %release_args; |
164
|
0
|
0
|
|
|
|
|
$release_args{group_sort} = $args{group_sort} if $args{group_sort}; |
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
my @output; |
167
|
|
|
|
|
|
|
|
168
|
0
|
0
|
|
|
|
|
if ( $self->changes->preamble ) { |
169
|
0
|
|
|
|
|
|
push @output, sprintf q[# %s], $self->changes->preamble; |
170
|
0
|
|
|
|
|
|
push @output, q[]; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my @r = $self->changes->releases; |
174
|
0
|
0
|
|
|
|
|
@r = reverse @r unless $args{reverse}; # not a typo! |
175
|
0
|
|
|
|
|
|
for my $release (@r) { |
176
|
0
|
|
|
|
|
|
push @output, $self->_serialize_release( release => $release, %release_args ); |
177
|
|
|
|
|
|
|
} |
178
|
0
|
|
|
|
|
|
return join qq[\n], @output; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
1
|
|
|
1
|
|
518
|
no Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
1; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
__END__ |