line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::POM::View::Trac; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
4
|
|
|
|
|
|
|
our $INDENT = 4; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
57424
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
3696
|
use Text::Wrap; |
|
1
|
|
|
|
|
12308
|
|
|
1
|
|
|
|
|
73
|
|
10
|
1
|
|
|
1
|
|
12
|
use base 'Pod::POM::View::Text'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1322
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
# Public Methods |
14
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub view_head1 { |
17
|
0
|
|
|
0
|
1
|
|
my ($self, $head1) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $title = $head1->title->present($self); |
20
|
0
|
|
|
|
|
|
my $output = "= $title =\n\n" . $head1->content->present($self); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
return $output; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub view_head2 { |
27
|
0
|
|
|
0
|
1
|
|
my ($self, $head2) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $title = $head2->title->present($self); |
30
|
0
|
|
|
|
|
|
my $output = "== $title ==\n\n" . $head2->content->present($self); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return $output; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub view_head3 { |
37
|
0
|
|
|
0
|
1
|
|
my ($self, $head3) = @_; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $title = $head3->title->present($self); |
40
|
0
|
|
|
|
|
|
my $output = "=== $title ===\n\n" . $head3->content->present($self); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $output; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub view_head4 { |
47
|
0
|
|
|
0
|
1
|
|
my ($self, $head4) = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $title = $head4->title->present($self); |
50
|
0
|
|
|
|
|
|
my $output = "==== $title ====\n\n" . $head4->content->present($self); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return $output; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
57
|
|
|
|
|
|
|
# view_over($self, $over) |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# Present an =over block - this is a blockquote if there are no =items |
60
|
|
|
|
|
|
|
# within the block. |
61
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub view_over { |
64
|
0
|
|
|
0
|
1
|
|
my ($self, $over) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if (@{$over->item}) { |
|
0
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $over->content->present($self); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} else { |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
my $indent = ref $self ? \$self->{INDENT} : \$INDENT; |
73
|
0
|
|
|
|
|
|
my $pad = ' ' x $$indent; |
74
|
0
|
|
|
|
|
|
my $text = $over->content->present($self); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
local $Text::Wrap::unexpand = 0; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $content = wrap($pad, $pad, $text) . "\n\n"; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return $content; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub view_item { |
87
|
0
|
|
|
0
|
1
|
|
my ($self, $item) = @_; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my $title = $item->title->present($self); |
90
|
0
|
|
|
|
|
|
my $text = $item->content->present($self); |
91
|
|
|
|
|
|
|
|
92
|
0
|
0
|
|
|
|
|
my $indent = ref $self ? \$self->{INDENT} : \$INDENT; |
93
|
0
|
|
|
|
|
|
my $pad = ' ' x $$indent; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
local $Text::Wrap::unexpand = 0; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $content = wrap($pad, $pad, $text) . "\n"; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return "$title\n\n$content"; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub view_for { |
104
|
0
|
|
|
0
|
1
|
|
my ($self, $for) = @_; |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
return '' unless $for->format() =~ /\btrac\b/; |
107
|
0
|
|
|
|
|
|
return $for->text() . "\n\n"; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub view_begin { |
112
|
0
|
|
|
0
|
1
|
|
my ($self, $begin) = @_; |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
return '' unless $begin->format() =~ /\btrac\b/; |
115
|
0
|
|
|
|
|
|
return $begin->content->present($self); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub view_textblock { |
120
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
$text =~ s/\s+/ /mg; |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
my $pad = ''; |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
local $Text::Wrap::unexpand = 0; |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
return wrap($pad, $pad, $text) . "\n\n"; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub view_verbatim { |
133
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
return "{{{\n$text\n}}}\n"; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub view_seq_bold { |
140
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
return "'''$text'''"; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub view_seq_italic { |
147
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return "''$text''"; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub view_seq_code { |
154
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
my $output = "`$text`"; |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
return $output; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub view_seq_file { |
163
|
0
|
|
|
0
|
1
|
|
my ($self, $text) = @_; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
return "source:$text"; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
my $entities = { |
170
|
|
|
|
|
|
|
gt => '>', |
171
|
|
|
|
|
|
|
lt => '<', |
172
|
|
|
|
|
|
|
amp => '&', |
173
|
|
|
|
|
|
|
quot => '"', |
174
|
|
|
|
|
|
|
}; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub view_seq_entity { |
177
|
0
|
|
|
0
|
1
|
|
my ($self, $entity) = @_; |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
0
|
|
|
|
return $entities->{ $entity } || $entity; |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub view_seq_index { |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
|
0
|
1
|
|
return ''; |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub view_seq_link { |
190
|
0
|
|
|
0
|
1
|
|
my ($self, $link) = @_; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# full-blown URL's are emitted as-is |
193
|
|
|
|
|
|
|
|
194
|
0
|
0
|
|
|
|
|
if ($link =~ /^\w+:\/\// ) { |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
# check to see if there is title |
197
|
|
|
|
|
|
|
|
198
|
0
|
0
|
|
|
|
|
if (my ($text, $name) = $link =~ m/^(.*)\|(.*)/) { |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
return "[$name $text]"; |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
return $link; |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# links to other modules are parsed out |
209
|
|
|
|
|
|
|
|
210
|
0
|
0
|
|
|
|
|
if (my ($text, $name) = $link =~ m/^(.*)\|(.*)/) { |
211
|
|
|
|
|
|
|
|
212
|
0
|
0
|
|
|
|
|
if ($name =~ /::/) { |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# make it wiki CamelCase link |
215
|
|
|
|
|
|
|
|
216
|
0
|
|
|
|
|
|
my @parts = split('::', $name); |
217
|
0
|
|
|
|
|
|
@parts = map {lc $_ } @parts; |
|
0
|
|
|
|
|
|
|
218
|
0
|
|
|
|
|
|
@parts = map {ucfirst $_} @parts; |
|
0
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
220
|
0
|
|
|
|
|
|
$name = join('', @parts); |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return "[wiki:$name $text]"; |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
# otherwise return it verbatim |
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
return "[wiki:$link]"; |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
1; |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
__END__ |