| 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 | |
||||||
| 38 | |||||||
| 39 | |
||||||
| 40 | |||||||
| 41 | |||||||
| 42 | =cut | ||||||
| 43 | |||||||
| 44 | 2 | 2 | 33001 | use strict; | |||
| 2 | 3 | ||||||
| 2 | 53 | ||||||
| 45 | 2 | 2 | 11 | use warnings; | |||
| 2 | 4 | ||||||
| 2 | 52 | ||||||
| 46 | 2 | 2 | 536 | use Perl6::Pod::To; | |||
| 2 | 6 | ||||||
| 2 | 54 | ||||||
| 47 | 2 | 2 | 9 | use base 'Perl6::Pod::To'; | |||
| 2 | 5 | ||||||
| 2 | 133 | ||||||
| 48 | 2 | 2 | 12 | use Perl6::Pod::Utl; | |||
| 2 | 4 | ||||||
| 2 | 37 | ||||||
| 49 | 2 | 2 | 9 | use Data::Dumper; | |||
| 2 | 5 | ||||||
| 2 | 587 | ||||||
| 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( '' . $self->{doctype} . '>' ) if $self->{doctype}; | ||||
| 78 | } | ||||||
| 79 | |||||||
| 80 | |||||||
| 81 | 1; | ||||||
| 82 | __END__ |