File Coverage

blib/lib/Perl6/Pod/Block/head.pm
Criterion Covered Total %
statement 18 44 40.9
branch 0 4 0.0
condition n/a
subroutine 6 10 60.0
pod 0 4 0.0
total 24 62 38.7


line stmt bran cond sub pod time code
1             #===============================================================================
2             #
3             # DESCRIPTION: =head
4             #
5             # AUTHOR: Aliaksandr P. Zahatski,
6             #===============================================================================
7             package Perl6::Pod::Block::head;
8              
9             =pod
10              
11             =head1 NAME
12              
13             Perl6::Pod::Block::head - handle B<=head> - Headings
14              
15             =head1 SYNOPSIS
16              
17              
18             =head1 A Top Level Heading
19             =head2 A Second Level Heading
20             =head3 A third level heading
21             =head86 A "Missed it by I much!" heading
22              
23             =head1 DESCRIPTION
24              
25             B<=head> - Headings
26              
27             Pod provides an unlimited number of levels of heading, specified by the
28             C<=headN> block marker.
29              
30             =cut
31              
32 3     3   15 use warnings;
  3         5  
  3         81  
33 3     3   13 use strict;
  3         5  
  3         59  
34 3     3   15 use Perl6::Pod::Block;
  3         4  
  3         59  
35 3     3   13 use base 'Perl6::Pod::Block';
  3         6  
  3         202  
36 3     3   17 use Perl6::Pod::Utl;
  3         5  
  3         58  
37 3     3   14 use Data::Dumper;
  3         4  
  3         1195  
38             our $VERSION = '0.01';
39              
40             sub level {
41 0     0 0   my $self = shift;
42 0 0         $self->{level} || 1; #default 1 level for head
43             }
44              
45             sub to_xhtml {
46 0     0 0   my ( $self, $to )= @_;
47 0           my $w = $to->w;
48 0           my $level = $self->level;
49 0           $w->raw( "");
50 0           $self->{content}->[0] = Perl6::Pod::Utl::parse_para($self->{content}->[0]);
51 0           $to->visit_childs($self);
52 0           $w->raw("" );
53             }
54              
55             sub to_docbook {
56 0     0 0   my ( $self, $to )= @_;
57 0           my $w = $to->w;
58 0           $w->raw( ""); </td> </tr> <tr> <td class="h" > <a name="59">59</a> </td> <td class="c0" > <a href="#60"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->{content}->[0] = Perl6::Pod::Utl::parse_para($self->{content}->[0]); </td> </tr> <tr> <td class="h" > <a name="60">60</a> </td> <td class="c0" > <a href="#61"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $to->visit_childs($self); </td> </tr> <tr> <td class="h" > <a name="61">61</a> </td> <td class="c0" > <a href="#66"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $w->raw("" );
62             }
63              
64              
65             sub to_latex {
66 0     0 0   my ( $self, $to )= @_;
67 0           my $w = $to->w;
68 0           my $level = $self->level;
69             #http://en.wikibooks.org/wiki/LaTeX/Document_Structure
70 0           my %level2latex =
71             ( 1 => 'section',
72             2 => 'subsection',
73             3 => 'subsubsection',
74             4 => 'paragraph',
75             5 => 'subparagraph'
76             );
77 0 0         unless (exists $level2latex{$level}) {
78 0           warn "Level $level not supported by pod6latex. Set to: 5";
79 0           $level = 5;
80             };
81              
82 0           $w->raw('\\'.$level2latex{$level}.'{');
83 0           $self->{content}->[0] = Perl6::Pod::Utl::parse_para($self->{content}->[0]);
84 0           $to->visit_childs($self);
85 0           $w->raw("}" );
86             }
87              
88             1;
89              
90             __END__