line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Simple::Role::XHTML::WithErrata; |
2
|
1
|
|
|
1
|
|
83009
|
use Moo::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.003001'; |
5
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
296
|
use HTML::Entities qw(encode_entities); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
409
|
use namespace::clean; |
|
1
|
|
|
|
|
9083
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
around _gen_errata => sub { |
12
|
|
|
|
|
|
|
return; # override the default errata formatting |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
around end_Document => sub { |
16
|
|
|
|
|
|
|
my $orig = shift; |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
$self->_emit_custom_errata |
19
|
|
|
|
|
|
|
if $self->{errata}; |
20
|
|
|
|
|
|
|
$self->$orig(@_); |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _emit_custom_errata { |
24
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $tag = sub { |
27
|
8
|
|
|
8
|
|
11
|
my $name = shift; |
28
|
8
|
|
|
|
|
11
|
my $attributes = ''; |
29
|
8
|
100
|
|
|
|
15
|
if ( ref( $_[0] ) ) { |
30
|
2
|
|
|
|
|
10
|
my $attr = shift; |
31
|
2
|
|
|
|
|
10
|
while ( my ( $k, $v ) = each %$attr ) { |
32
|
2
|
|
|
|
|
6
|
$attributes .= qq{ $k="} . encode_entities($v) . '"'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
8
|
100
|
|
|
|
33
|
my @body = map { /^ ? $_ : encode_entities($_) } @_; |
|
11
|
|
|
|
|
30
|
|
36
|
8
|
|
|
|
|
86
|
return join( '', "<$name$attributes>", @body, "$name>" ); |
37
|
1
|
|
|
|
|
4
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my @errors = map { |
40
|
1
|
|
|
|
|
2
|
my $line = $_; |
41
|
1
|
|
|
|
|
2
|
my $error = $self->{'errata'}->{$line}; |
42
|
|
|
|
|
|
|
( |
43
|
|
|
|
|
|
|
$tag->( 'dt', "Around line $line:" ), |
44
|
1
|
|
|
|
|
3
|
$tag->( 'dd', map { $tag->( 'p', $_ ) } @$error ), |
|
1
|
|
|
|
|
3
|
|
45
|
|
|
|
|
|
|
); |
46
|
1
|
|
|
|
|
2
|
} sort { $a <=> $b } keys %{ $self->{'errata'} }; |
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
3
|
|
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
2
|
my $error_count = keys %{ $self->{'errata'} }; |
|
1
|
|
|
|
|
2
|
|
49
|
1
|
50
|
|
|
|
3
|
my $s = $error_count == 1 ? '' : 's'; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
3
|
$self->{'scratch'} = $tag->( |
52
|
|
|
|
|
|
|
'div', |
53
|
|
|
|
|
|
|
{ class => "pod-errors" }, |
54
|
|
|
|
|
|
|
$tag->( 'p', "$error_count POD Error$s" ), |
55
|
|
|
|
|
|
|
$tag->( |
56
|
|
|
|
|
|
|
'div', |
57
|
|
|
|
|
|
|
{ class => "pod-errors-detail" }, |
58
|
|
|
|
|
|
|
$tag->( |
59
|
|
|
|
|
|
|
'p', |
60
|
|
|
|
|
|
|
'The following errors were encountered while parsing the POD:' |
61
|
|
|
|
|
|
|
), |
62
|
|
|
|
|
|
|
$tag->( 'dl', @errors ), |
63
|
|
|
|
|
|
|
), |
64
|
|
|
|
|
|
|
); |
65
|
1
|
|
|
|
|
4
|
$self->emit; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
__END__ |