line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Simple::Wiki::Usemod; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Pod::Simple::Wiki::Usemod - A class for creating Pod to Usemod filters. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright 2003-2012, John McNamara, jmcnamara@cpan.org |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# Documentation after __END__ |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# perltidy with the following options: -mbl=2 -pt=0 -nola |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
18
|
use Pod::Simple::Wiki; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
107
|
|
16
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
83
|
|
17
|
3
|
|
|
3
|
|
15
|
use vars qw(@ISA $VERSION); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1675
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
@ISA = qw(Pod::Simple::Wiki); |
21
|
|
|
|
|
|
|
$VERSION = '0.20'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
############################################################################### |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# The tag to wiki mappings. |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
my $tags = { |
29
|
|
|
|
|
|
|
'' => '', |
30
|
|
|
|
|
|
|
'' => '', |
31
|
|
|
|
|
|
|
'' => '', |
32
|
|
|
|
|
|
|
'' => '', |
33
|
|
|
|
|
|
|
'' => '', |
34
|
|
|
|
|
|
|
'' => '', |
35
|
|
|
|
|
|
|
'' => "\n\n", |
36
|
|
|
|
|
|
|
'' => "\n\n\n", |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
'' => "\n= ", |
39
|
|
|
|
|
|
|
'' => " =\n\n", |
40
|
|
|
|
|
|
|
'' => "\n== ", |
41
|
|
|
|
|
|
|
'' => " ==\n\n", |
42
|
|
|
|
|
|
|
'' => "\n=== ", |
43
|
|
|
|
|
|
|
'' => " ===\n", |
44
|
|
|
|
|
|
|
'' => "\n==== ", |
45
|
|
|
|
|
|
|
'' => " ====\n\n", |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
############################################################################### |
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# new() |
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
# Simple constructor inheriting from Pod::Simple::Wiki. |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
sub new { |
56
|
|
|
|
|
|
|
|
57
|
22
|
|
|
22
|
1
|
34
|
my $class = shift; |
58
|
22
|
|
|
|
|
79
|
my $self = Pod::Simple::Wiki->new( 'wiki', @_ ); |
59
|
22
|
|
|
|
|
53
|
$self->{_tags} = $tags; |
60
|
|
|
|
|
|
|
|
61
|
22
|
|
|
|
|
37
|
bless $self, $class; |
62
|
22
|
|
|
|
|
64
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
############################################################################### |
67
|
|
|
|
|
|
|
# |
68
|
|
|
|
|
|
|
# _indent_item() |
69
|
|
|
|
|
|
|
# |
70
|
|
|
|
|
|
|
# Indents an "over-item" to the correct level. |
71
|
|
|
|
|
|
|
# |
72
|
|
|
|
|
|
|
sub _indent_item { |
73
|
|
|
|
|
|
|
|
74
|
37
|
|
|
37
|
|
49
|
my $self = shift; |
75
|
37
|
|
|
|
|
71
|
my $item_type = $_[0]; |
76
|
37
|
|
|
|
|
45
|
my $item_param = $_[1]; |
77
|
37
|
|
|
|
|
52
|
my $indent_level = $self->{_item_indent}; |
78
|
|
|
|
|
|
|
|
79
|
37
|
100
|
|
|
|
106
|
if ( $item_type eq 'bullet' ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
80
|
12
|
|
|
|
|
47
|
$self->_append( '*' x $indent_level ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif ( $item_type eq 'number' ) { |
83
|
12
|
|
|
|
|
40
|
$self->_append( '#' x $indent_level ); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
elsif ( $item_type eq 'text' ) { |
86
|
13
|
|
|
|
|
43
|
$self->_append( ';' x $indent_level ); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
############################################################################### |
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
# _handle_text() |
94
|
|
|
|
|
|
|
# |
95
|
|
|
|
|
|
|
# Perform any necessary transforms on the text. This is mainly used to escape |
96
|
|
|
|
|
|
|
# inadvertent CamelCase words. |
97
|
|
|
|
|
|
|
# |
98
|
|
|
|
|
|
|
sub _handle_text { |
99
|
|
|
|
|
|
|
|
100
|
60
|
|
|
60
|
|
478
|
my $self = shift; |
101
|
60
|
|
|
|
|
88
|
my $text = $_[0]; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# Split the text into tokens but maintain the whitespace |
104
|
60
|
|
|
|
|
269
|
my @tokens = split /(\s+)/, $text; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# Escape any tokens here. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Rejoin the tokens and whitespace. |
109
|
60
|
|
|
|
|
248
|
$self->{_wiki_text} .= join '', @tokens; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
############################################################################### |
114
|
|
|
|
|
|
|
# |
115
|
|
|
|
|
|
|
# Functions to deal with =over ... =back regions for |
116
|
|
|
|
|
|
|
# |
117
|
|
|
|
|
|
|
# Bulleted lists |
118
|
|
|
|
|
|
|
# Numbered lists |
119
|
|
|
|
|
|
|
# Text lists |
120
|
|
|
|
|
|
|
# Block lists |
121
|
|
|
|
|
|
|
# |
122
|
13
|
|
|
13
|
|
33
|
sub _end_item_text { $_[0]->_output( ':' ) } |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
############################################################################### |
126
|
|
|
|
|
|
|
# |
127
|
|
|
|
|
|
|
# _start_Para() |
128
|
|
|
|
|
|
|
# |
129
|
|
|
|
|
|
|
# Special handling for paragraphs that are part of an "over" block. |
130
|
|
|
|
|
|
|
# |
131
|
|
|
|
|
|
|
sub _start_Para { |
132
|
|
|
|
|
|
|
|
133
|
19
|
|
|
19
|
|
45
|
my $self = shift; |
134
|
19
|
|
|
|
|
30
|
my $indent_level = $self->{_item_indent}; |
135
|
|
|
|
|
|
|
|
136
|
19
|
100
|
|
|
|
74
|
if ( $self->{_in_over_block} ) { |
137
|
1
|
|
|
|
|
5
|
$self->_append( ":" x $indent_level ); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
__END__ |