blib/lib/Perl6/Perldoc/To/Ansi.pm

filter: Statementstmt 38.1% 135 / 354 Branchbran 2.3% 2 / 86 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 68.5% 96 / 140 Podpod 0.0% 0 / 3 totaltotal 39.2% 233 / 594 CC 50 SCAR 29.5
CC
50
Cov
31%
to_ansi
182.0
rewrite_ansi
56.0
to_ansi
30.0
CRAP 19.0
↑ Summary
1 package Perl6::Perldoc::To::Ansi;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $Perl6::Perldoc::To::Ansi::AUTHORITY = 'cpan:HINRIK';
4 }
5 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $Perl6::Perldoc::To::Ansi::VERSION = '0.11';
7 }
8  
9 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # add fake opening/closing tags, to be processed later
13 0 ▶sub add_ansi {
Subroutine add_ansi: not called CC=1 SCAR=6.9
Pod undocumented
14 0 my ($text, $new) = @_;
15 0 return "\e[OPEN${new}m" . $text . "\e[CLOSE${new}m";
16 }
17  
18 # same, but only if the entire text is not already colored
19 0 ▶sub add_ansi_only {
Subroutine add_ansi_only: not called CC=3 SCAR=24.8
Pod undocumented
20 0 my ($text, $new) = @_;
21 0 ▶ return $text if $text =~ /^\e\[/ && $text =~ /\e\[0?m$/;
Branch: 1 branch
BranchTrueFalseTotal
if $text =~ /^\e\[/ and $text =~ /\e\[0?m$/ 0 0 0
Condition0%0/3
$text =~ /^\e\[/ and $text =~ /\e\[0?m$/
!ll&&!rl&&r
000
MC/DC0%0/2
$text =~ /^\e\[/ and $text =~ /\e\[0?m$/
$text =~ /^\e\[/ $text =~ /\e\[0?m$/
Truth table0%0/3
A and B
A= $text =~ /^\e\[/B= $text =~ /\e\[0?m$/
ABresult
0X0
100
111
22 0 return add_ansi($text, $new);
23 }
24  
25 0 ▶sub rewrite_ansi {
Subroutine rewrite_ansi: not called CC=7 SCAR=40.3
Pod undocumented
26 0 my ($text) = @_;
27 #$text = "\e[${new}m$text";
28 #$text =~ s/(?:\e\[m)*$//;
29  
30 0 my @code_stack;
31 0 ▶ my $current = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
32 0 my $ret = '';
33 0 $ret .= "\e[${_}m" for @code_stack;
34 0 return $ret;
35 0 };
36
37 0 $text =~ s{( \e\[.+?m | \n )}{
38 0 my $match = $1;
39 #$match =~ s/(?:\e\[m)+//g;
40 #$match =~ s/^\e\[|m$//g;
41 0 my $subst = '';
42  
43 0 ▶ if ($match eq "\n") {
Branch: 3 branches
BranchTrueFalseTotal
if ($match eq "\n") { } 0 0 0
elsif (my($add) = $match =~ /\e\[OPEN(.+?)m/) { } 0 0 0
elsif (my($remove) = $match =~ /\e\[CLOSE(.+?)m/) { } 0 0 0
44 # re-apply codes because newline resets them
45 0 $subst = "\n" . $current->();
46 }
47 elsif (my ($add) = $match =~ /\e\[OPEN(.+?)m/) {
48 #print "add: $add\n";
49 # keep track of a new code
50 0 push @code_stack, $add;
51 0 $subst = "\e[${add}m";
52 }
53 elsif (my ($remove) = $match =~ /\e\[CLOSE(.+?)m/) {
54 #print "remove: $remove\n";
55 # remove this code and re-apply the rest
56 0 pop @code_stack;
57 0 ▶ for (my $i = $#code_stack; $i >= 0; $i--) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= 0) 0 0 0
58 0 ▶ if ($code_stack[$i] eq $remove) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code_stack[$i] eq $remove) 0 0 0
59 0 ▶ splice @code_stack, $i, 1 if $code_stack[$i];
Branch: 1 branch
BranchTrueFalseTotal
if $code_stack[$i] 0 0 0
60 0 last;
61 }
62 }
63 0 $subst = "\e[m" . $current->();
64 }
65
66 0 $subst;
67 }egmx;
68  
69 0 $text .= "\e[m" x scalar @code_stack;
70 0 return $text;
71 }
72  
73 package Perl6::Perldoc::Parser::ReturnVal;
74 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
75 1 $Perl6::Perldoc::Parser::ReturnVal::AUTHORITY = 'cpan:HINRIK';
76 }
77 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
78 1 $Perl6::Perldoc::Parser::ReturnVal::VERSION = '0.11';
79 }
80  
81 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=4 SCAR=30.0
82 0 my ($self, $internal_state) = @_;
83  
84 0 ▶ $internal_state ||= {};
Condition0%0/2
$internal_state ||= {}
l!l
00
MC/DC0%0/1
$internal_state ||= {}
$internal_state
Truth table0%0/2
A
A= $internal_state
Aresult
11
00
85  
86 0 my $text_rep = $self->{tree}->to_ansi($internal_state);
87  
88 0 ▶ if (($internal_state->{note_count}||0) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (($internal_state->{"note_count"} || 0) > 0) 0 0 0
Condition0%0/2
$internal_state->{'note_count'} || 0
l!l
00
MC/DC0%0/1
$internal_state->{'note_count'} || 0
$internal_state->{'note_count'}
Truth table0%0/2
A
A= $internal_state->{'note_count'}
Aresult
11
00
89 0 $text_rep .= "\nNotes\n\n$internal_state->{notes}";
90 }
91  
92 0 return Perl6::Perldoc::To::Ansi::rewrite_ansi($text_rep);
93 }
94  
95 package Perl6::Perldoc::Root;
96 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
97 1 $Perl6::Perldoc::Root::AUTHORITY = 'cpan:HINRIK';
98 }
99 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
100 1 $Perl6::Perldoc::Root::VERSION = '0.11';
101 }
102  
103 1 my $INDENT = 4;
104  
105 0 ▶sub add_ansi_nesting {
Subroutine add_ansi_nesting: not called CC=3 SCAR=24.8
106 0 my ($self, $text, $depth) = @_;
107  
108 # Nest according to the specified nestedness of the block...
109 0 ▶ if (my $nesting = $self->option('nested')) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $nesting = $self->option('nested')) { } 0 0 0
elsif (not defined $depth) { } 0 0 0
110 0 $depth = $nesting * $INDENT;
111 }
112  
113 # Or else default to one indent...
114 elsif (!defined $depth) {
115 0 $depth = $INDENT;
116 }
117  
118 0 my $indent = q{ } x $depth;
119 0 $text =~ s{^}{$indent}gxms;
120 0 return $text;
121 }
122  
123 0 ▶sub _list_to_ansi {
Subroutine _list_to_ansi: not called CC=4 SCAR=30.0
124 0 my ($list_ref, $state_ref) = @_;
125 0 my $text = q{};
126 0 for my $content ( @{$list_ref} ) {
127 0 ▶ next if ! defined $content;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $content 0 0 0
128 0 ▶ if (ref $content) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $content) { } 0 0 0
129 0 $text .= $content->to_ansi($state_ref);
130 }
131 else {
132 0 $text .= $content;
133 }
134 }
135 0 $text =~ s{\A \n+}{}xms;
136 0 $text =~ s{\n+ \z}{\n}xms;
137 0 return $text;
138 }
139  
140 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
141 0 my $self = shift;
142 0 return $self->add_ansi_nesting(_list_to_ansi([$self->content], @_),0);
143 }
144  
145 # Representation of file itself...
146 package Perl6::Perldoc::Document;
147 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
148 1 $Perl6::Perldoc::Document::AUTHORITY = 'cpan:HINRIK';
149 }
150 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
151 1 $Perl6::Perldoc::Document::VERSION = '0.11';
152 }
153 1 ▶ use base 'Perl6::Perldoc::Root';
Subroutine BEGIN: called CC=1 SCAR=0.0
154  
155 # Ambient text around the Pod...
156 package Perl6::Perldoc::Ambient;
157 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
158 1 $Perl6::Perldoc::Ambient::AUTHORITY = 'cpan:HINRIK';
159 }
160 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
161 1 $Perl6::Perldoc::Ambient::VERSION = '0.11';
162 }
163  
164 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
165 0 return q{};
166 }
167  
168 # Pod blocks...
169 package Perl6::Perldoc::Block;
170 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
171 1 $Perl6::Perldoc::Block::AUTHORITY = 'cpan:HINRIK';
172 }
173 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
174 1 $Perl6::Perldoc::Block::VERSION = '0.11';
175 }
176  
177 # Standard =pod block...
178 package Perl6::Perldoc::Block::pod;
179 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
180 1 $Perl6::Perldoc::Block::pod::AUTHORITY = 'cpan:HINRIK';
181 }
182 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
183 1 $Perl6::Perldoc::Block::pod::VERSION = '0.11';
184 }
185  
186 # Standard =para block (may be implicit)...
187 package Perl6::Perldoc::Block::para;
188 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
189 1 $Perl6::Perldoc::Block::para::AUTHORITY = 'cpan:HINRIK';
190 }
191 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
192 1 $Perl6::Perldoc::Block::para::VERSION = '0.11';
193 }
194  
195 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
196 0 my $self = shift;
197 0 return "\n" . $self->SUPER::to_ansi(@_);
198 }
199  
200 # Standard =code block (may be implicit)...
201 package Perl6::Perldoc::Block::code;
202 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
203 1 $Perl6::Perldoc::Block::code::AUTHORITY = 'cpan:HINRIK';
204 }
205 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
206 1 $Perl6::Perldoc::Block::code::VERSION = '0.11';
207 }
208  
209 0 ▶sub ansi_min {
Subroutine ansi_min: not called CC=3 SCAR=24.8
210 0 my $min = shift;
211 0 for my $next (@_) {
212 0 ▶ $min = $next if $next < $min;
Branch: 1 branch
BranchTrueFalseTotal
if $next < $min 0 0 0
213 }
214 0 return $min;
215 }
216  
217 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
218 0 my $self = shift;
219 0 my $text = Perl6::Perldoc::Root::_list_to_ansi([$self->content],@_);
220 0 my $left_space = ansi_min map { length } $text =~ m{^ [^\S\n]* (?= \S) }gxms;
221 0 $text =~ s{^ [^\S\n]{$left_space} }{}gxms;
222 0 $text = Perl6::Perldoc::To::Ansi::add_ansi($text, '33');
223 0 return "\n" . $self->add_ansi_nesting($text, $INDENT);
224 }
225  
226  
227 # Standard =input block
228 package Perl6::Perldoc::Block::input;
229 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
230 1 $Perl6::Perldoc::Block::input::AUTHORITY = 'cpan:HINRIK';
231 }
232 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
233 1 $Perl6::Perldoc::Block::input::VERSION = '0.11';
234 }
235  
236 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
237 0 my $self = shift;
238 0 my $text = Perl6::Perldoc::Root::_list_to_ansi([$self->content],@_);
239 0 $text = Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '36');
240 0 return "\n" . $self->add_ansi_nesting($text, $INDENT);
241 }
242  
243  
244 # Standard =output block
245 package Perl6::Perldoc::Block::output;
246 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
247 1 $Perl6::Perldoc::Block::output::AUTHORITY = 'cpan:HINRIK';
248 }
249 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
250 1 $Perl6::Perldoc::Block::output::VERSION = '0.11';
251 }
252  
253 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
254 0 my $self = shift;
255 0 my $text = Perl6::Perldoc::Root::_list_to_ansi([$self->content],@_);
256 0 $text = Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '36');
257 0 return "\n" . $self->add_ansi_nesting($text, $INDENT);
258 }
259  
260 # Standard =config block...
261 package Perl6::Perldoc::Config;
262 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
263 1 $Perl6::Perldoc::Config::AUTHORITY = 'cpan:HINRIK';
264 }
265 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
266 1 $Perl6::Perldoc::Config::VERSION = '0.11';
267 }
268  
269 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
270 0 return q{};
271 }
272  
273 # Standard =table block...
274 package Perl6::Perldoc::Block::table;
275 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
276 1 $Perl6::Perldoc::Block::table::AUTHORITY = 'cpan:HINRIK';
277 }
278 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
279 1 $Perl6::Perldoc::Block::table::VERSION = '0.11';
280 }
281  
282 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
283 0 my $self = shift;
284 0 my ($text) = $self->content;
285 0 return "\n" . $self->add_ansi_nesting($text, $INDENT);
286 }
287  
288  
289 # Standard =head1 block...
290 package Perl6::Perldoc::Block::head1;
291 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
292 1 $Perl6::Perldoc::Block::head1::AUTHORITY = 'cpan:HINRIK';
293 }
294 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
295 1 $Perl6::Perldoc::Block::head1::VERSION = '0.11';
296 }
297  
298 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=2 SCAR=17.9
299 0 my $self = shift;
300 0 my $title = $self->SUPER::to_ansi(@_);
301 0 $title =~ s{\A\s+|\s+\Z}{}gxms;
302 0 $title =~ s{\s+}{ }gxms;
303 0 my $number = $self->number;
304 0 ▶ if (defined $number) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $number) 0 0 0
305 0 $title = "$number. $title";
306 }
307 0 return "\n" . Perl6::Perldoc::To::Ansi::add_ansi_only($title, '1') ."\n";
308 }
309  
310 # Standard =head2 block...
311 package Perl6::Perldoc::Block::head2;
312 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
313 1 $Perl6::Perldoc::Block::head2::AUTHORITY = 'cpan:HINRIK';
314 }
315 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
316 1 $Perl6::Perldoc::Block::head2::VERSION = '0.11';
317 }
318  
319 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=2 SCAR=17.9
320 0 my $self = shift;
321 0 my $title = $self->SUPER::to_ansi(@_);
322 0 $title =~ s{\A\s+|\s+\Z}{}gxms;
323 0 $title =~ s{\s+}{ }gxms;
324 0 my $number = $self->number;
325 0 ▶ if (defined $number) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $number) 0 0 0
326 0 $title = "$number. $title";
327 }
328 0 return "\n" . Perl6::Perldoc::To::Ansi::add_ansi_only($title, '1') ."\n";
329 }
330  
331 # Standard =head3 block...
332 package Perl6::Perldoc::Block::head3;
333 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
334 1 $Perl6::Perldoc::Block::head3::AUTHORITY = 'cpan:HINRIK';
335 }
336 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
337 1 $Perl6::Perldoc::Block::head3::VERSION = '0.11';
338 }
339  
340 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=2 SCAR=17.9
341 0 my $self = shift;
342 0 my $title = $self->SUPER::to_ansi(@_);
343 0 $title =~ s{\A\s+|\s+\Z}{}gxms;
344 0 $title =~ s{\s+}{ }gxms;
345 0 my $number = $self->number;
346 0 ▶ if (defined $number) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $number) 0 0 0
347 0 $title = "$number. $title";
348 }
349 0 return "\n" . Perl6::Perldoc::To::Ansi::add_ansi_only($title, '1') ."\n";
350 }
351  
352 # Standard =head4 block...
353 package Perl6::Perldoc::Block::head4;
354 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
355 1 $Perl6::Perldoc::Block::head4::AUTHORITY = 'cpan:HINRIK';
356 }
357 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
358 1 $Perl6::Perldoc::Block::head4::VERSION = '0.11';
359 }
360  
361 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=2 SCAR=17.9
362 0 my $self = shift;
363 0 my $title = $self->SUPER::to_ansi(@_);
364 0 $title =~ s{\A\s+|\s+\Z}{}gxms;
365 0 $title =~ s{\s+}{ }gxms;
366 0 my $number = $self->number;
367 0 ▶ if (defined $number) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $number) 0 0 0
368 0 $title = "$number. $title";
369 }
370 0 return "\n" . Perl6::Perldoc::To::Ansi::add_ansi_only($title, '1') ."\n";
371 }
372  
373 # Implicit list block...
374 package Perl6::Perldoc::Block::list;
375 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
376 1 $Perl6::Perldoc::Block::list::AUTHORITY = 'cpan:HINRIK';
377 }
378 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
379 1 $Perl6::Perldoc::Block::list::VERSION = '0.11';
380 }
381 1 ▶ use base 'Perl6::Perldoc::Root';
Subroutine BEGIN: called CC=1 SCAR=0.0
382  
383 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
384 0 my $self = shift;
385 0 return "\n" . $self->add_ansi_nesting($self->SUPER::to_ansi(@_));
386 }
387  
388  
389 # Standard =item block...
390 package Perl6::Perldoc::Block::item;
391 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
392 1 $Perl6::Perldoc::Block::item::AUTHORITY = 'cpan:HINRIK';
393 }
394 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
395 1 $Perl6::Perldoc::Block::item::VERSION = '0.11';
396 }
397  
398 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=4 SCAR=30.0
399 0 my $self = shift;
400  
401 0 my $counter = $self->number;
402 0 ▶ $counter = $counter ? qq{$counter.} : q{*};
Branch: 1 branch
BranchTrueFalseTotal
$counter ? : 0 0 0
403  
404 0 my $body = $self->SUPER::to_ansi(@_);
405  
406 0 ▶ if (my $term = $self->term()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $term = $self->term) 0 0 0
407 0 $term = $self->term( {as_objects=>1} )->to_ansi(@_);
408 0 ▶ if (length $counter) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $counter) 0 0 0
409 0 $term =~ s{\A (\s* <[^>]+>)}{$1$counter. }xms;
410 }
411 0 my $body = $self->add_ansi_nesting($body);
412 0 $body =~ s{\A \n+}{}xms;
413 0 return "\n$term\n$body";
414 }
415  
416 0 $body = $self->add_ansi_nesting($body, 1 + length $counter);
417 0 $body =~ s{\A \n+}{}xms;
418 0 $body =~ s{\A \s*}{$counter }xms;
419  
420 0 return $body;
421 }
422  
423 # Implicit toclist block...
424 package Perl6::Perldoc::Block::toclist;
425 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
426 1 $Perl6::Perldoc::Block::toclist::AUTHORITY = 'cpan:HINRIK';
427 }
428 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
429 1 $Perl6::Perldoc::Block::toclist::VERSION = '0.11';
430 }
431 1 ▶ use base 'Perl6::Perldoc::Root';
Subroutine BEGIN: called CC=1 SCAR=0.0
432  
433 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
434 0 my $self = shift;
435
436 # Convert list items to text, and return in an text list...
437 0 my $text = join q{}, map {$_->to_ansi(@_)} $self->content;
438  
439 0 return $self->add_ansi_nesting($text);
440 }
441  
442  
443 # Standard =tocitem block...
444 package Perl6::Perldoc::Block::tocitem;
445 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
446 1 $Perl6::Perldoc::Block::tocitem::AUTHORITY = 'cpan:HINRIK';
447 }
448 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
449 1 $Perl6::Perldoc::Block::tocitem::VERSION = '0.11';
450 }
451  
452 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=2 SCAR=17.9
453 0 my $self = shift;
454  
455 0 my @title = $self->title;
456 0 ▶ return "" if ! @title;
Branch: 1 branch
BranchTrueFalseTotal
unless @title 0 0 0
457
458 0 my $title = Perl6::Perldoc::Root::_list_to_ansi(\@title, @_);
459  
460 0 return "* $title\n";
461 }
462  
463 # Handle headN's and itemN's and tocitemN's...
464 1 for my $depth (1..100) {
465 1 ▶ no strict qw< refs >;
Subroutine BEGIN: called CC=1 SCAR=0.0
466  
467 100 @{'Perl6::Perldoc::Block::item'.$depth.'::ISA'}
468 = 'Perl6::Perldoc::Block::item';
469  
470 100 @{'Perl6::Perldoc::Block::tocitem'.$depth.'::ISA'}
471 = 'Perl6::Perldoc::Block::tocitem';
472  
473 100 ▶ next if $depth < 5;
Branch: 1 branch
BranchTrueFalseTotal
if $depth < 5 4 96 100
474 96 @{'Perl6::Perldoc::Block::head'.$depth.'::ISA'}
475 = 'Perl6::Perldoc::Block::head4';
476 }
477 # Handle headN's and itemN's
478 1 for my $depth (1..100) {
479 1 ▶ no strict qw< refs >;
Subroutine BEGIN: called CC=1 SCAR=0.0
480 100 @{'Perl6::Perldoc::Block::item'.$depth.'::ISA'}
481 = 'Perl6::Perldoc::Block::item';
482 }
483  
484 # Standard =nested block...
485 package Perl6::Perldoc::Block::nested;
486 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
487 1 $Perl6::Perldoc::Block::nested::AUTHORITY = 'cpan:HINRIK';
488 }
489 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
490 1 $Perl6::Perldoc::Block::nested::VERSION = '0.11';
491 }
492  
493 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
494 0 my $self = shift;
495 0 return "\n" . $self->add_ansi_nesting($self->SUPER::to_ansi(@_));
496 }
497  
498 # Standard =comment block...
499 package Perl6::Perldoc::Block::comment;
500 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
501 1 $Perl6::Perldoc::Block::comment::AUTHORITY = 'cpan:HINRIK';
502 }
503 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
504 1 $Perl6::Perldoc::Block::comment::VERSION = '0.11';
505 }
506  
507 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
508 0 return q{};
509 }
510  
511 # Standard SEMANTIC blocks...
512 package Perl6::Perldoc::Block::Semantic;
513 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
514 1 $Perl6::Perldoc::Block::Semantic::AUTHORITY = 'cpan:HINRIK';
515 }
516 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
517 1 $Perl6::Perldoc::Block::Semantic::VERSION = '0.11';
518 }
519 1 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=8.8
520 1 my @semantic_blocks = qw(
521 NAME NAMES
522 VERSION VERSIONS
523 SYNOPSIS SYNOPSES
524 DESCRIPTION DESCRIPTIONS
525 USAGE USAGES
526 INTERFACE INTERFACES
527 METHOD METHODS
528 SUBROUTINE SUBROUTINES
529 OPTION OPTIONS
530 DIAGNOSTIC DIAGNOSTICS
531 ERROR ERRORS
532 WARNING WARNINGS
533 DEPENDENCY DEPENDENCIES
534 BUG BUGS
535 SEEALSO SEEALSOS
536 ACKNOWLEDGEMENT ACKNOWLEDGEMENTS
537 AUTHOR AUTHORS
538 COPYRIGHT COPYRIGHTS
539 DISCLAIMER DISCLAIMERS
540 LICENCE LICENCES
541 LICENSE LICENSES
542 TITLE TITLES
543 SECTION SECTIONS
544 CHAPTER CHAPTERS
545 APPENDIX APPENDIXES APPENDICES
546 TOC TOCS
547 INDEX INDEXES INDICES
548 FOREWORD FOREWORDS
549 SUMMARY SUMMARIES
550 );
551  
552 # Reuse content-to-text converter
553 1 *_list_to_ansi = *Perl6::Perldoc::Root::_list_to_ansi;
554  
555 1 for my $blockname (@semantic_blocks) {
556 1 ▶ no strict qw< refs >;
Subroutine BEGIN: called CC=1 SCAR=0.0
557  
558 60 *{ "Perl6::Perldoc::Block::${blockname}::to_ansi" }
559 0 ▶ = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
560 0 my $self = shift;
561  
562 0 my @title = $self->title();
563  
564 0 ▶ return "" if !@title;
Branch: 1 branch
BranchTrueFalseTotal
unless @title 0 0 0
565 0 my $title = _list_to_ansi(\@title, @_);
566  
567 0 return "\n" . Perl6::Perldoc::To::Ansi::add_ansi(uc $title, '1') ."\n\n"
568 . _list_to_ansi([$self->content], @_);
569 60 };
570 }
571 }
572  
573  
574 # Base class for formatting codes...
575  
576 package Perl6::Perldoc::FormattingCode;
577 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
578 1 $Perl6::Perldoc::FormattingCode::AUTHORITY = 'cpan:HINRIK';
579 }
580 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
581 1 $Perl6::Perldoc::FormattingCode::VERSION = '0.11';
582 }
583  
584 package Perl6::Perldoc::FormattingCode::Named;
585 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
586 1 $Perl6::Perldoc::FormattingCode::Named::AUTHORITY = 'cpan:HINRIK';
587 }
588 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
589 1 $Perl6::Perldoc::FormattingCode::Named::VERSION = '0.11';
590 }
591  
592 # Basis formatter...
593 package Perl6::Perldoc::FormattingCode::B;
594 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
595 1 $Perl6::Perldoc::FormattingCode::B::AUTHORITY = 'cpan:HINRIK';
596 }
597 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
598 1 $Perl6::Perldoc::FormattingCode::B::VERSION = '0.11';
599 }
600  
601 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
602 0 my $self = shift;
603 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '1');
604 }
605  
606 # Code formatter...
607 package Perl6::Perldoc::FormattingCode::C;
608 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
609 1 $Perl6::Perldoc::FormattingCode::C::AUTHORITY = 'cpan:HINRIK';
610 }
611 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
612 1 $Perl6::Perldoc::FormattingCode::C::VERSION = '0.11';
613 }
614  
615 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
616 0 my $self = shift;
617 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '33');
618 }
619  
620 # Definition formatter...
621 package Perl6::Perldoc::FormattingCode::D;
622 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
623 1 $Perl6::Perldoc::FormattingCode::D::AUTHORITY = 'cpan:HINRIK';
624 }
625 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
626 1 $Perl6::Perldoc::FormattingCode::D::VERSION = '0.11';
627 }
628  
629 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
630 0 my $self = shift;
631 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '1');
632 }
633  
634  
635 # Entity formatter...
636 package Perl6::Perldoc::FormattingCode::E;
637 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
638 1 $Perl6::Perldoc::FormattingCode::E::AUTHORITY = 'cpan:HINRIK';
639 }
640 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
641 1 $Perl6::Perldoc::FormattingCode::E::VERSION = '0.11';
642 }
643  
644 1 my %is_break_entity = (
645 'LINE FEED (LF)' => 1, LF => 1,
646 'CARRIAGE RETURN (CR)' => 1, CR => 1,
647 'NEXT LINE (NEL)' => 1, NEL => 1,
648  
649 'FORM FEED (FF)' => 10, FF => 10,
650 );
651  
652 1 my %is_translatable = (
653 nbsp => q{ },
654 bull => q{*},
655 mdash => q{--},
656 ndash => q{--},
657 );
658  
659 # Convert E<> contents to text named or numeric entity...
660 0 ▶sub _to_ansi_entity {
Subroutine _to_ansi_entity: not called CC=5 SCAR=30.5
661 0 my ($spec) = @_;
662 # Is it a line break?
663 0 ▶ if (my $BR_count = $is_break_entity{$spec}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $BR_count = $is_break_entity{$spec}) 0 0 0
664 0 return "\n" x $BR_count;
665 }
666 # Is it a numeric codepoint in some base...
667 0 ▶ if ($spec =~ m{\A \d}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($spec =~ /\A \d/msx) 0 0 0
668 # Convert Perl 6 octals and decimals to Perl 5 notation...
669 0 ▶ if ($spec !~ s{\A 0o}{0}xms) { # Convert octal
Branch: 1 branch
BranchTrueFalseTotal
unless ($spec =~ s/\A 0o/0/msx) 0 0 0
670 0 $spec =~ s{\A 0d}{}xms; # Convert explicit decimal
671 0 $spec =~ s{\A 0+ (?=\d)}{}xms; # Convert implicit decimal
672 }
673  
674 # Then return the Xtext numeric code...
675 1 ▶ use charnames ':full';
Subroutine BEGIN: called CC=1 SCAR=0.0
676 0 $spec = charnames::viacode(eval $spec);
677 }
678 0 ▶ if (my $replacement = $is_translatable{$spec}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $replacement = $is_translatable{$spec}) { } 0 0 0
679 0 return $replacement;
680 }
681 else {
682 0 return "[$spec]";
683 }
684 }
685  
686 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
687 0 my $self = shift;
688 0 my $entities = $self->content;
689 0 return join q{}, map {_to_ansi_entity($_)} split /\s*;\s*/, $entities;
690 }
691  
692 # Important formatter...
693 package Perl6::Perldoc::FormattingCode::I;
694 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
695 1 $Perl6::Perldoc::FormattingCode::I::AUTHORITY = 'cpan:HINRIK';
696 }
697 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
698 1 $Perl6::Perldoc::FormattingCode::I::VERSION = '0.11';
699 }
700  
701 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
702 0 my $self = shift;
703 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '32');
704 }
705  
706 # Keyboard input formatter...
707 package Perl6::Perldoc::FormattingCode::K;
708 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
709 1 $Perl6::Perldoc::FormattingCode::K::AUTHORITY = 'cpan:HINRIK';
710 }
711 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
712 1 $Perl6::Perldoc::FormattingCode::K::VERSION = '0.11';
713 }
714  
715 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
716 0 my $self = shift;
717 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '36');
718 }
719  
720 # Link formatter...
721 package Perl6::Perldoc::FormattingCode::L;
722 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
723 1 $Perl6::Perldoc::FormattingCode::L::AUTHORITY = 'cpan:HINRIK';
724 }
725 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
726 1 $Perl6::Perldoc::FormattingCode::L::VERSION = '0.11';
727 }
728  
729 1 my $PERLDOC_ORG = 'http://perldoc.perl.org/';
730 1 my $SEARCH = 'http://www.google.com/search?q=';
731  
732 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=13 SCAR=52.0
733 0 my $self = shift;
734 0 my $target = $self->target();
735 0 ▶ my $text = $self->has_distinct_text ? $self->SUPER::to_ansi(@_) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->has_distinct_text ? : 0 0 0
736 0 ▶ my $add_color = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
737 0 $target = Perl6::Perldoc::To::Ansi::add_ansi($target, '34');
738 0 };
739
740 # Link within this document...
741 0 ▶ if ($target =~ s{\A (?:doc:\s*)? [#] }{}xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A (?:doc:\s*)? [#] //msx) 0 0 0
742 0 $add_color->();
743 0 ▶ return defined $text ? qq{$text (see the $target section)}
Branch: 1 branch
BranchTrueFalseTotal
defined $text ? : 0 0 0
744 : qq{the $target section}
745 }
746  
747 # Link to other documentation...
748 0 ▶ if ($target =~ s{\A doc: }{}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A doc: //msx) 0 0 0
749 0 $add_color->();
750 0 ▶ return defined $text ? qq{$text (see the documentation for $target)}
Branch: 1 branch
BranchTrueFalseTotal
defined $text ? : 0 0 0
751 : qq{the documentation for $target}
752 }
753  
754 # Link to manpage...
755 0 ▶ if ($target =~ s{\A man: }{}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A man: //msx) 0 0 0
756 0 $add_color->();
757 0 ▶ return defined $text ? qq{$text (see the $target manpage)}
Branch: 1 branch
BranchTrueFalseTotal
defined $text ? : 0 0 0
758 : qq{the $target manpage}
759 }
760  
761 # Link back to definition in this document...
762 0 ▶ if ($target =~ s{\A (?:defn) : }{}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A (?:defn) : //msx) 0 0 0
763 0 $add_color->();
764 0 ▶ return defined $text ? qq{$text (see the definition of $target)}
Branch: 1 branch
BranchTrueFalseTotal
defined $text ? : 0 0 0
765 : $target
766 }
767  
768 # Link to an email address
769 0 ▶ if ($target =~ s{\A (?:mailto) : }{}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A (?:mailto) : //msx) 0 0 0
770 0 $add_color->();
771 0 ▶ return defined $text ? qq{$text ($target)}
Branch: 1 branch
BranchTrueFalseTotal
defined $text ? : 0 0 0
772 : $target
773 }
774  
775 # Anything else...
776 0 $add_color->();
777 0 ▶ return defined $text ? qq{$text $target}
Branch: 1 branch
BranchTrueFalseTotal
defined $text ? : 0 0 0
778 : $target;
779 }
780  
781 # Meta-formatter...
782 package Perl6::Perldoc::FormattingCode::M;
783 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
784 1 $Perl6::Perldoc::FormattingCode::M::AUTHORITY = 'cpan:HINRIK';
785 }
786 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
787 1 $Perl6::Perldoc::FormattingCode::M::VERSION = '0.11';
788 }
789  
790  
791 # Note formatter...
792 package Perl6::Perldoc::FormattingCode::N;
793 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
794 1 $Perl6::Perldoc::FormattingCode::N::AUTHORITY = 'cpan:HINRIK';
795 }
796 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
797 1 $Perl6::Perldoc::FormattingCode::N::VERSION = '0.11';
798 }
799  
800 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
801 0 my $self = shift;
802 0 my $count = ++$_[0]{note_count};
803 0 my $marker = "[$count]";
804 0 $_[0]{notes} .= qq{$marker } . $self->SUPER::to_ansi(@_) . "\n";
805 0 return qq{$marker};
806 }
807  
808 # Placement link formatter...
809 package Perl6::Perldoc::FormattingCode::P;
810 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
811 1 $Perl6::Perldoc::FormattingCode::P::AUTHORITY = 'cpan:HINRIK';
812 }
813 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
814 1 $Perl6::Perldoc::FormattingCode::P::VERSION = '0.11';
815 }
816  
817 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=5 SCAR=34.0
818 0 my $self = shift;
819 0 my $target = $self->target();
820  
821 # Link within this document...
822 0 ▶ if ($target =~ s{\A (?:doc:\s*)? [#] }{}xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A (?:doc:\s*)? [#] //msx) 0 0 0
823 0 return qq{(See the "$target" section)};
824 }
825  
826 # Link to other documentation...
827 0 ▶ if ($target =~ s{\A doc: }{}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A doc: //msx) 0 0 0
828 0 return qq{(See the documentation for $target)};
829 }
830  
831 # Link to manpage...
832 0 ▶ if ($target =~ s{\A man: }{}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A man: //msx) 0 0 0
833 0 return qq{(See the $target manpage)};
834 }
835  
836 # TOC insertion...
837 0 ▶ if ($target =~ s{\A toc: }{}xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target =~ s/\A toc: //msx) 0 0 0
838 0 return Perl6::Perldoc::Root::_list_to_ansi([$self->content],@_);
839 }
840  
841 # Anything else...
842 0 $target =~ s{\A (?:defn) : }{}xms;
843 0 return qq{(See $target)};
844 }
845  
846 # Replacable item formatter...
847 package Perl6::Perldoc::FormattingCode::R;
848 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
849 1 $Perl6::Perldoc::FormattingCode::R::AUTHORITY = 'cpan:HINRIK';
850 }
851 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
852 1 $Perl6::Perldoc::FormattingCode::R::VERSION = '0.11';
853 }
854  
855 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
856 0 my $self = shift;
857 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '32');
858 }
859  
860 # Space-preserving formatter...
861 package Perl6::Perldoc::FormattingCode::S;
862 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
863 1 $Perl6::Perldoc::FormattingCode::S::AUTHORITY = 'cpan:HINRIK';
864 }
865 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
866 1 $Perl6::Perldoc::FormattingCode::S::VERSION = '0.11';
867 }
868  
869 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
870 0 my $self = shift;
871 0 return $self->SUPER::to_ansi(@_);
872 }
873  
874  
875 # Terminal output formatter...
876 package Perl6::Perldoc::FormattingCode::T;
877 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
878 1 $Perl6::Perldoc::FormattingCode::T::AUTHORITY = 'cpan:HINRIK';
879 }
880 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
881 1 $Perl6::Perldoc::FormattingCode::T::VERSION = '0.11';
882 }
883  
884 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
885 0 my $self = shift;
886 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '36');
887 }
888  
889 # Unusual formatter...
890 package Perl6::Perldoc::FormattingCode::U;
891 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
892 1 $Perl6::Perldoc::FormattingCode::U::AUTHORITY = 'cpan:HINRIK';
893 }
894 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
895 1 $Perl6::Perldoc::FormattingCode::U::VERSION = '0.11';
896 }
897  
898 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
899 0 my $self = shift;
900 0 return Perl6::Perldoc::To::Ansi::add_ansi($self->SUPER::to_ansi(@_), '4');
901 }
902  
903 # Verbatim formatter...
904 package Perl6::Perldoc::FormattingCode::V;
905 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
906 1 $Perl6::Perldoc::FormattingCode::V::AUTHORITY = 'cpan:HINRIK';
907 }
908 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
909 1 $Perl6::Perldoc::FormattingCode::V::VERSION = '0.11';
910 }
911  
912 # indeX formatter...
913 package Perl6::Perldoc::FormattingCode::X;
914 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
915 1 $Perl6::Perldoc::FormattingCode::X::AUTHORITY = 'cpan:HINRIK';
916 }
917 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
918 1 $Perl6::Perldoc::FormattingCode::X::VERSION = '0.11';
919 }
920  
921 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
922 0 return q{};
923 }
924  
925 # Zero-width formatter...
926 package Perl6::Perldoc::FormattingCode::Z;
927 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
928 1 $Perl6::Perldoc::FormattingCode::Z::AUTHORITY = 'cpan:HINRIK';
929 }
930 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
931 1 $Perl6::Perldoc::FormattingCode::Z::VERSION = '0.11';
932 }
933  
934 0 ▶sub to_ansi {
Subroutine to_ansi: not called CC=1 SCAR=6.9
935 0 return q{};
936 }
937  
938  
939 # Standard =table block...
940 package Perl6::Perldoc::Block::table;
941  
942  
943 1 1; # Magic true value required at end of module
944  
945 =encoding utf8
946  
947 =head1 NAME
948  
949 Perl6::Perldoc::To::Ansi - ANSI-colored text renderer for Perl6::Perldoc
950  
951 =head1 SYNOPSIS
952  
953 use Perl6::Perldoc::Parser;
954 use Perl6::Perldoc::To::Ansi;
955  
956 # All Perl6::Perldoc::Parser DOM classes now have a to_ansi() method
957  
958 =head1 DESCRIPTION
959  
960 This module is almost identical to the Text renderer, except that many
961 constructs are highlighted with ANSI terminal codes. See
962 L<Perl6::Perldoc::To::Text> for more information.
963  
964 =head1 AUTHOR
965  
966 Hinrik Örn Sigurðsson, L<hinrik.sig@gmail.com>
967  
968 =head1 LICENCE AND COPYRIGHT
969  
970 Copyright (c) 2006, Damian Conway L<DCONWAY@cpan.org>. All rights reserved.
971  
972 Copyright (c) 2009, Hinrik Örn Sigurðsson L<hinrik.sig@gmail.com>. All rights reserved.
973  
974 This module is free software; you can redistribute it and/or
975 modify it under the same terms as Perl itself. See L<perlartistic>.
976  
977 =cut
↑ Summary