| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Perl6::Pod::Block::code; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Perl6::Pod::Block::code - Verbatim pre-formatted sample source code |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=begin code |
|
12
|
|
|
|
|
|
|
print "Ok"; |
|
13
|
|
|
|
|
|
|
=end code |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Code blocks are used to specify pre-formatted text (typically source code), which should be rendered without rejustification, without whitespace-squeezing, and without recognizing any inline formatting codes. Code blocks also have an implicit nesting associated with them. Typically these blocks are used to show examples of code, mark-up, or other textual specifications, and are rendered using a fixed-width font. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
A code block may be implicitly specified as one or more lines of text, each of which starts with a whitespace character. The block is terminated by a blank line. For example: |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This ordinary paragraph introduces a code block: |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$this = 1 * code('block'); |
|
24
|
|
|
|
|
|
|
$which.is_specified(:by); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Implicit code blocks may only be used within =pod, =item, =nested, =END, or semantic blocks. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
98
|
|
|
32
|
3
|
|
|
3
|
|
16
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
74
|
|
|
33
|
3
|
|
|
3
|
|
383944
|
use Data::Dumper; |
|
|
3
|
|
|
|
|
12407
|
|
|
|
3
|
|
|
|
|
208
|
|
|
34
|
3
|
|
|
3
|
|
1040
|
use Test::More; |
|
|
3
|
|
|
|
|
20930
|
|
|
|
3
|
|
|
|
|
34
|
|
|
35
|
3
|
|
|
3
|
|
1042
|
use Perl6::Pod::Block; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
87
|
|
|
36
|
3
|
|
|
3
|
|
18
|
use base 'Perl6::Pod::Block'; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
265
|
|
|
37
|
3
|
|
|
3
|
|
1861
|
use Perl6::Pod::Utl; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
839
|
|
|
38
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 to_xhtml |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=code |
|
43
|
|
|
|
|
|
|
test code |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Render to: |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
test code |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub to_xhtml { |
|
53
|
0
|
|
|
0
|
1
|
|
my ( $self, $to ) = @_; |
|
54
|
0
|
|
|
|
|
|
$to->w->raw(''); |
|
55
|
0
|
0
|
|
|
|
|
if ( my $allow = $self->get_attr->{allow} ) { |
|
56
|
|
|
|
|
|
|
$self->{content} = |
|
57
|
0
|
|
|
|
|
|
Perl6::Pod::Utl::parse_para( $self->childs->[0], allow => $allow ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
0
|
|
|
|
|
|
$to->visit_childs($self); |
|
60
|
0
|
|
|
|
|
|
$to->w->raw(''); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 to_docbook |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=code |
|
66
|
|
|
|
|
|
|
test code |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Render to: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
]]> |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub to_docbook { |
|
76
|
0
|
|
|
0
|
1
|
|
my ( $self, $to ) = @_; |
|
77
|
0
|
|
|
|
|
|
$to->w->raw( |
|
78
|
|
|
|
|
|
|
'
|
|
79
|
0
|
|
|
|
|
|
$to->w->raw($_) for @{$self->childs}; |
|
|
0
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
$to->w->raw(']]>'); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub to_latex { |
|
85
|
0
|
|
|
0
|
0
|
|
my ( $self, $to ) = @_; |
|
86
|
0
|
0
|
|
|
|
|
if ( my $allow = $self->get_attr->{allow} ) { |
|
87
|
|
|
|
|
|
|
$self->{content} = |
|
88
|
0
|
|
|
|
|
|
Perl6::Pod::Utl::parse_para( $self->childs->[0], allow => $allow ); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
0
|
|
|
|
|
|
$to->w->say('\begin{verbatim}'); |
|
91
|
0
|
|
|
|
|
|
$to->visit_childs($self); |
|
92
|
0
|
|
|
|
|
|
$to->w->raw('\end{verbatim}'); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
|
96
|
|
|
|
|
|
|
__END__ |