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
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
83
|
|
33
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
58
|
|
34
|
3
|
|
|
3
|
|
15
|
use Perl6::Pod::Block; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
60
|
|
35
|
3
|
|
|
3
|
|
14
|
use base 'Perl6::Pod::Block'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
191
|
|
36
|
3
|
|
|
3
|
|
15
|
use Perl6::Pod::Utl; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
61
|
|
37
|
3
|
|
|
3
|
|
14
|
use Data::Dumper; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1216
|
|
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( ""); |
59
|
0
|
|
|
|
|
|
$self->{content}->[0] = Perl6::Pod::Utl::parse_para($self->{content}->[0]); |
60
|
0
|
|
|
|
|
|
$to->visit_childs($self); |
61
|
0
|
|
|
|
|
|
$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__ |