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