blib/lib/PPI/Transform/Doxygen/POD.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 52 SCAR 6.9
CC
1
Cov
0%
view_pod
2.0
view_head1
2.0
view_head2
2.0
CRAP 2.0
1 package PPI::Transform::Doxygen::POD;
2  
3 use 5.010001;
4 use strict;
5 use warnings;
6 use parent qw(Pod::POM::View::HTML);
7  
8 our $VERSION = '0.1';
9  
10 our $PREFIX = '';
11  
12 sub view_pod {
13 my ($self, $pod) = @_;
14 return $pod->content->present($self);
15 }
16  
17 sub view_head1 {
18 my ($self, $head1) = @_;
19 my $title = $head1->title->present($self);
20 my $name = $title;
21 $name =~ s/\s/_/g;
22 return "\n\@section ${PREFIX}_$name $title\n" . $head1->content->present($self);
23 }
24  
25 sub view_head2 {
26 my ($self, $head2) = @_;
27 my $title = $head2->title->present($self);
28 my $name = $title;
29 $name =~ s/\s/_/g;
30 return "\n\@subsection $name $title\n" . $head2->content->present($self);
31 }
32  
33 sub view_seq_code {
34 my ($self, $text) = @_;
35 _unquote($text);
36 return "\n\@code\n$text\n\@endcode\n";
37 }
38  
39 sub view_verbatim {
40 my ($self, $text) = @_;
41 _unquote($text);
42 return "\n\@code\n$text\n\@endcode\n";
43 }
44  
45 my %HTML = ( '&amp;' => '&', '&lt;' => '<', '&gt;' => '>');
46 sub _unquote {
47 $_[0] =~ s!\Q$_!$HTML{$_}!g for keys %HTML;
48 $_[0] =~ s!\\(\@|\\|\%|#)!$1!g;
49 }
50  
51  
52 1;
53  
54 __END__