line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#** @file POD.pm |
2
|
|
|
|
|
|
|
# @verbatim |
3
|
|
|
|
|
|
|
##################################################################### |
4
|
|
|
|
|
|
|
# This program is not guaranteed to work at all, and by using this # |
5
|
|
|
|
|
|
|
# program you release the author of any and all liability. # |
6
|
|
|
|
|
|
|
# # |
7
|
|
|
|
|
|
|
# You may use this code as long as you are in compliance with the # |
8
|
|
|
|
|
|
|
# license (see the LICENSE file) and this notice, disclaimer and # |
9
|
|
|
|
|
|
|
# comment box remain intact and unchanged. # |
10
|
|
|
|
|
|
|
# # |
11
|
|
|
|
|
|
|
# Package: Doxygen::Filter::Perl # |
12
|
|
|
|
|
|
|
# Class: POD # |
13
|
|
|
|
|
|
|
# Description: Methods for prefiltering Perl code for Doxygen # |
14
|
|
|
|
|
|
|
# # |
15
|
|
|
|
|
|
|
# Written by: Bret Jordan (jordan at open1x littledot org) # |
16
|
|
|
|
|
|
|
# Created: 2011-10-13 # |
17
|
|
|
|
|
|
|
##################################################################### |
18
|
|
|
|
|
|
|
# @endverbatim |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# @copy 2011, Bret Jordan (jordan2175@gmail.com, jordan@open1x.org) |
21
|
|
|
|
|
|
|
# $Id: POD.pm 88 2012-07-07 04:27:35Z jordan2175 $ |
22
|
|
|
|
|
|
|
#* |
23
|
|
|
|
|
|
|
package Doxygen::Filter::Perl::POD; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
11
|
use 5.8.8; |
|
1
|
|
|
|
|
3
|
|
26
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
27
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
28
|
1
|
|
|
1
|
|
4
|
use parent qw(Pod::POM::View::HTML); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
29
|
1
|
|
|
1
|
|
5376
|
use Log::Log4perl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $VERSION = '1.72'; |
32
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
33
|
|
|
|
|
|
|
our $labelCnt = 0; # label counter to see to it that when e.g. twice a =head1 NAME in a file it is still an unique label |
34
|
|
|
|
|
|
|
our $sectionLabel = 'x'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub convertText |
37
|
|
|
|
|
|
|
{ |
38
|
|
|
|
|
|
|
# based on e.g. a file name try to create a doxygen label prefix |
39
|
0
|
|
|
0
|
0
|
|
my $label = shift; |
40
|
0
|
|
|
|
|
|
$label =~ s/_/__/g; |
41
|
0
|
|
|
|
|
|
$label =~ s/:/_1/g; |
42
|
0
|
|
|
|
|
|
$label =~ s/\//_2/g; |
43
|
0
|
|
|
|
|
|
$label =~ s/
|
44
|
0
|
|
|
|
|
|
$label =~ s/>/_4/g; |
45
|
0
|
|
|
|
|
|
$label =~ s/\*/_5/g; |
46
|
0
|
|
|
|
|
|
$label =~ s/&/_6/g; |
47
|
0
|
|
|
|
|
|
$label =~ s/\|/_7/g; |
48
|
0
|
|
|
|
|
|
$label =~ s/\./_8/g; |
49
|
0
|
|
|
|
|
|
$label =~ s/!/_9/g; |
50
|
0
|
|
|
|
|
|
$label =~ s/,/_00/g; |
51
|
0
|
|
|
|
|
|
$label =~ s/ /_01/g; |
52
|
0
|
|
|
|
|
|
$label =~ s/{/_02/g; |
53
|
0
|
|
|
|
|
|
$label =~ s/}/_03/g; |
54
|
0
|
|
|
|
|
|
$label =~ s/\?/_04/g; |
55
|
0
|
|
|
|
|
|
$label =~ s/\^/_05/g; |
56
|
0
|
|
|
|
|
|
$label =~ s/%/_06/g; |
57
|
0
|
|
|
|
|
|
$label =~ s/\(/_07/g; |
58
|
0
|
|
|
|
|
|
$label =~ s/\)/_08/g; |
59
|
0
|
|
|
|
|
|
$label =~ s/\+/_09/g; |
60
|
0
|
|
|
|
|
|
$label =~ s/=/_0A/g; |
61
|
0
|
|
|
|
|
|
$label =~ s/\$/_0B/g; |
62
|
0
|
|
|
|
|
|
$label =~ s/\\/_0C/g; |
63
|
0
|
|
|
|
|
|
$label =~ s/@/_0D/g; |
64
|
0
|
|
|
|
|
|
$label =~ s/-/_0E/g; |
65
|
0
|
|
|
|
|
|
$label =~ s/[^a-z0-9A-Z]/_/g; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$label = "x$label"; # label should not start with a underscore |
68
|
0
|
|
|
|
|
|
return $label; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub convertTitle |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
0
|
0
|
|
my $title = shift; |
74
|
0
|
|
|
|
|
|
$title =~ s/\n/ /g; |
75
|
0
|
|
|
|
|
|
return $title; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub setAsLabel |
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
# based on e.g. a file name try to create a doxygen label prefix |
81
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
82
|
0
|
|
|
|
|
|
my $tmpLabel = shift; |
83
|
0
|
|
|
|
|
|
$sectionLabel = convertText($tmpLabel); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub view_pod |
87
|
|
|
|
|
|
|
{ |
88
|
0
|
|
|
0
|
1
|
|
my ($self, $pod) = @_; |
89
|
0
|
|
|
|
|
|
return $pod->content->present($self); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub view_head1 |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
0
|
1
|
|
my ($self, $head1) = @_; |
95
|
0
|
|
|
|
|
|
my $title = $head1->title->present($self); |
96
|
0
|
|
|
|
|
|
my $name = convertText($title); |
97
|
0
|
|
|
|
|
|
$title = convertTitle($title); |
98
|
0
|
|
|
|
|
|
$labelCnt += 1; |
99
|
0
|
|
|
|
|
|
return "\n\@section $sectionLabel$name$labelCnt $title\n" . $head1->content->present($self); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub view_head2 |
103
|
|
|
|
|
|
|
{ |
104
|
0
|
|
|
0
|
1
|
|
my ($self, $head2) = @_; |
105
|
0
|
|
|
|
|
|
my $title = $head2->title->present($self); |
106
|
0
|
|
|
|
|
|
my $name = convertText($title); |
107
|
0
|
|
|
|
|
|
$title = convertTitle($title); |
108
|
0
|
|
|
|
|
|
$labelCnt += 1; |
109
|
0
|
|
|
|
|
|
return "\n\@subsection $sectionLabel$name$labelCnt $title\n" . $head2->content->present($self); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub view_head3 |
113
|
|
|
|
|
|
|
{ |
114
|
0
|
|
|
0
|
1
|
|
my ($self, $head3) = @_; |
115
|
0
|
|
|
|
|
|
my $title = $head3->title->present($self); |
116
|
0
|
|
|
|
|
|
my $name = convertText($title); |
117
|
0
|
|
|
|
|
|
$title = convertTitle($title); |
118
|
0
|
|
|
|
|
|
$labelCnt += 1; |
119
|
0
|
|
|
|
|
|
return "\n\@subsubsection $sectionLabel$name$labelCnt $title\n" . $head3->content->present($self); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub view_head4 |
123
|
|
|
|
|
|
|
{ |
124
|
0
|
|
|
0
|
1
|
|
my ($self, $head4) = @_; |
125
|
0
|
|
|
|
|
|
my $title = $head4->title->present($self); |
126
|
0
|
|
|
|
|
|
my $name = convertText($title); |
127
|
0
|
|
|
|
|
|
$title = convertTitle($title); |
128
|
0
|
|
|
|
|
|
$labelCnt += 1; |
129
|
0
|
|
|
|
|
|
return "\n\@paragraph $sectionLabel$name$labelCnt $title\n" . $head4->content->present($self); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub view_seq_code |
134
|
|
|
|
|
|
|
{ |
135
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
136
|
0
|
|
|
|
|
|
$text =~ s/"/\\"/g; |
137
|
0
|
|
|
|
|
|
return "$text "; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub encode { |
141
|
0
|
|
|
0
|
0
|
|
my($self,$text) = @_; |
142
|
0
|
|
|
|
|
|
return $text; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub view_verbatim { |
148
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
149
|
0
|
|
|
|
|
|
for ($text) { |
150
|
0
|
|
|
|
|
|
s/&/&/g; |
151
|
0
|
|
|
|
|
|
s/</g; |
152
|
0
|
|
|
|
|
|
s/>/>/g; |
153
|
0
|
|
|
|
|
|
s/-/\\-/g; |
154
|
|
|
|
|
|
|
} |
155
|
0
|
|
|
|
|
|
return "$text \n\n"; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 NAME |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Doxygen::Filter::Perl::POD - A perl code pre-filter for Doxygen |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 DESCRIPTION |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
The Doxygen::Filter::Perl::POD is a helper module for use with Doxygen::Filter::Perl |
166
|
|
|
|
|
|
|
and should not be called directly. This class actually overloads some of the methods |
167
|
|
|
|
|
|
|
found in Pod::POM::View::HTML and converts their output to be in a Doxygen style that |
168
|
|
|
|
|
|
|
Doxygen::Filter::Perl can use. The reason I went this route is Pod::POM appears to |
169
|
|
|
|
|
|
|
be well established and pretty good at parsing POD. I thus did not want to reinvent |
170
|
|
|
|
|
|
|
the wheel when it appears that this wheel works pretty well. Now this class should |
171
|
|
|
|
|
|
|
probably find its way in to the Pod::POM::View tree at some point. But for now it |
172
|
|
|
|
|
|
|
is here. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHOR |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Bret Jordan or |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 LICENSE |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
This is free software, licensed under the Apache License, Version 2.0. |
181
|
|
|
|
|
|
|
See the LICENSE file included with this package for license details. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=cut |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
return 1; |