File Coverage

blib/lib/Perl6/Pod/To/XHTML.pm
Criterion Covered Total %
statement 18 34 52.9
branch 0 6 0.0
condition 0 2 0.0
subroutine 6 8 75.0
pod 0 2 0.0
total 24 52 46.1


line stmt bran cond sub pod time code
1             package Perl6::Pod::To::XHTML;
2              
3             =pod
4              
5             =head1 NAME
6              
7             Perl6::Pod::To::XHTML - XHTML formater
8              
9             =head1 SYNOPSIS
10              
11             my $p = new Perl6::Pod::To::XHTML::
12              
13             add root tag
14             my $p = new Perl6::Pod::To::XHTML::
15             doctype => 'html',
16            
17              
18             =head1 DESCRIPTION
19              
20             Process pod to xhtml
21              
22             Sample:
23              
24             =begin pod
25             =NAME Test chapter
26             =para This is a test para
27             =end pod
28              
29             Run converter:
30              
31             pod6xhtml test.pod > test.xhtml
32              
33             Result xml:
34              
35            
36            
37             Test chapter
38            
39             This is a test para
40            
41              
42             =cut
43              
44 2     2   46698 use strict;
  2         4  
  2         73  
45 2     2   11 use warnings;
  2         5  
  2         63  
46 2     2   776 use Perl6::Pod::To;
  2         6  
  2         55  
47 2     2   11 use base 'Perl6::Pod::To';
  2         4  
  2         175  
48 2     2   10 use Perl6::Pod::Utl;
  2         3  
  2         39  
49 2     2   11 use Data::Dumper;
  2         2  
  2         534  
50             our $VERSION = '0.01';
51              
52              
53             sub start_write {
54 0     0 0   my $self = shift;
55 0           my $w = $self->writer;
56 0 0         $self->w->raw_print( '<' . $self->{doctype} . ' xmlns="http://www.w3.org/1999/xhtml">') if $self->{doctype};
57             }
58              
59              
60             sub end_write {
61 0     0 0   my $self = shift;
62             #export N<> notes
63 0   0       my $notes = $self->{CODE_N}||[];
64 0 0         if (my $count = scalar(@$notes)) {
65 0           my $w = $self->w;
66 0           $w->raw('
')
67             ->raw('

NOTES

');
68 0           my $nid = 1;
69 0           foreach my $n (@$notes) {
70 0           $w->raw(qq!

${nid}. !);

71 0           $self->visit_childs($n);
72 0           $w->raw('

');
73 0           $nid++;
74             }
75 0           $self->w->raw('');
76             }
77 0 0         $self->w->raw_print( '{doctype} . '>' ) if $self->{doctype};
78             }
79              
80              
81             1;
82             __END__