Knit/Output/Pod.pm

filter: Statementstmt 100% 44 / 44 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 100% 53 / 53 CC 3 SCAR 4.4
CC
3
Cov
100%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Knit/Plugin/Authors.pm ↑ Summary Knit/Plugin/NamedSections.pm »
1 package Pod::Knit::Output::Pod;
2 14 our $AUTHORITY = 'cpan:YANICK';
3 14 $Pod::Knit::Output::Pod::VERSION = '0.0.1';
4 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 14 ▶use Text::Wrap;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 14 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 14 ▶use XML::XSS;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 has as_pod => (
14 is => 'ro',
15 lazy => 1,
16 12 ▶ default => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
17 12 my $self = shift;
18
19 12 my $xss = XML::XSS->new;
20  
21 12 $xss->set( 'document' => {
22 pre => "=pod\n\n=encoding UTF-8\n\n",
23 post => "=cut\n\n",
24 });
25  
26 12 $xss->set( 'section' => { pre => '', post => '' } );
27  
28 $xss->set( "head$_" => {
29 pre => "=head$_ ",
30 post => "\n\n",
31 12 }) for 1..4;
32  
33 12 $xss->set( 'title' => {
34 pre => '',
35 post => "\n\n",
36 });
37  
38 $xss->set( 'verbatim' => {
39 pre => '',
40 3 ▶ content => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
41 3 my( $self, $node ) = @_;
42 3 my $output = $self->render( $node->childNodes );
43 3 $output =~ s/^/ /mgr;
44 },
45 12 post => "\n\n",
46 });
47  
48 12 $xss->set( $_ => { pre => uc($_).'<', post => '>' } ) for qw/ b i c f/;
49  
50 $xss->set( l => {
51 pre => 'L<',
52 post => '>',
53 1 ▶ content => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
54 1 my ( $self, $node, $args ) = @_;
55 1 return $node->getAttribute('raw');
56 },
57 12 });
58  
59 12 $xss->set( 'item-text' => {
60 pre => "=item ",
61 post => "\n\n",
62 });
63  
64 12 $xss->set( 'over-text' => {
65 pre => "=over\n\n",
66 post => "=back\n\n",
67 });
68  
69 12 $xss->set( 'over-bullet' => {
70 pre => "=over\n\n",
71 post => "=back\n\n",
72 });
73  
74 12 $xss->set( 'item-bullet' => {
75 pre => "=item *\n\n",
76 post => "\n\n",
77 });
78  
79 12 $xss->set( '#text' => {
80 } );
81  
82 $xss->set( 'para' => {
83 17 ▶ content => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
84 17 my( $self, $node ) = @_;
85 17 my $output = $self->render( $node->childNodes );
86 17 $output =~ s/^\s+|\s+$//g;
87 17 return wrap( '', '', $output ) . "\n\n";
88 },
89 12 } );
90  
91 12 $xss->render( $self->xml_pod );
92  
93 }
94 14 );
95  
96 14 1;
97  
98 __END__
« Knit/Plugin/Authors.pm ↑ Summary Knit/Plugin/NamedSections.pm »