| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pod::Simple::Wiki::Moinmoin; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Pod::Simple::Wiki::Moinmoin - A class for creating Pod to Moinmoin 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
|
2
|
|
|
2
|
|
8
|
use Pod::Simple::Wiki; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
57
|
|
|
16
|
2
|
|
|
2
|
|
7
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
51
|
|
|
17
|
2
|
|
|
2
|
|
8
|
use vars qw(@ISA $VERSION); |
|
|
2
|
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
891
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
@ISA = qw(Pod::Simple::Wiki); |
|
21
|
|
|
|
|
|
|
$VERSION = '0.18'; |
|
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", |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
'' => "\n== ", |
|
39
|
|
|
|
|
|
|
'' => " ==\n\n", |
|
40
|
|
|
|
|
|
|
'' => "\n=== ", |
|
41
|
|
|
|
|
|
|
'' => " ===\n\n", |
|
42
|
|
|
|
|
|
|
'' => "\n==== ", |
|
43
|
|
|
|
|
|
|
'' => " ====\n\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
|
21
|
|
|
21
|
1
|
26
|
my $class = shift; |
|
58
|
21
|
|
|
|
|
53
|
my $self = Pod::Simple::Wiki->new( 'wiki', @_ ); |
|
59
|
21
|
|
|
|
|
29
|
$self->{_tags} = $tags; |
|
60
|
|
|
|
|
|
|
|
|
61
|
21
|
|
|
|
|
29
|
bless $self, $class; |
|
62
|
21
|
|
|
|
|
45
|
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
|
40
|
|
|
40
|
|
36
|
my $self = shift; |
|
75
|
40
|
|
|
|
|
30
|
my $item_type = $_[0]; |
|
76
|
40
|
|
|
|
|
32
|
my $item_param = $_[1]; |
|
77
|
40
|
|
|
|
|
40
|
my $indent_level = $self->{_item_indent}; |
|
78
|
|
|
|
|
|
|
|
|
79
|
40
|
100
|
|
|
|
81
|
if ( $item_type eq 'bullet' ) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
80
|
13
|
|
|
|
|
39
|
$self->_append( ' ' x $indent_level . "* " ); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
elsif ( $item_type eq 'number' ) { |
|
83
|
13
|
|
|
|
|
36
|
$self->_append( ' ' x $indent_level . "1. " ); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
elsif ( $item_type eq 'text' ) { |
|
86
|
14
|
|
|
|
|
34
|
$self->_append( ' ' x $indent_level ); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
40
|
|
|
|
|
82
|
$self->{_moinmoin_list} = 1; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
############################################################################### |
|
94
|
|
|
|
|
|
|
# |
|
95
|
|
|
|
|
|
|
# _handle_text() |
|
96
|
|
|
|
|
|
|
# |
|
97
|
|
|
|
|
|
|
# Perform any necessary transforms on the text. This is mainly used to escape |
|
98
|
|
|
|
|
|
|
# inadvertent CamelCase words. |
|
99
|
|
|
|
|
|
|
# |
|
100
|
|
|
|
|
|
|
sub _handle_text { |
|
101
|
|
|
|
|
|
|
|
|
102
|
66
|
|
|
66
|
|
335
|
my $self = shift; |
|
103
|
66
|
|
|
|
|
62
|
my $text = $_[0]; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Split the text into tokens but maintain the whitespace |
|
106
|
66
|
|
|
|
|
261
|
my @tokens = split /(\s+)/, $text; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Escape any tokens here. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Rejoin the tokens and whitespace. |
|
111
|
66
|
|
|
|
|
198
|
$self->{_wiki_text} .= join '', @tokens; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
############################################################################### |
|
116
|
|
|
|
|
|
|
# |
|
117
|
|
|
|
|
|
|
# Functions to deal with =over ... =back regions for |
|
118
|
|
|
|
|
|
|
# |
|
119
|
|
|
|
|
|
|
# Bulleted lists |
|
120
|
|
|
|
|
|
|
# Numbered lists |
|
121
|
|
|
|
|
|
|
# Text lists |
|
122
|
|
|
|
|
|
|
# Block lists |
|
123
|
|
|
|
|
|
|
# |
|
124
|
|
|
|
|
|
|
sub _end_item_text { |
|
125
|
14
|
|
|
14
|
|
30
|
$_[0]->_output( ":: " ); |
|
126
|
14
|
|
|
|
|
26
|
$_[0]->{_moinmoin_list} = 0; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
############################################################################### |
|
130
|
|
|
|
|
|
|
# |
|
131
|
|
|
|
|
|
|
# _start_Para() |
|
132
|
|
|
|
|
|
|
# |
|
133
|
|
|
|
|
|
|
# Special handling for paragraphs that are part of an "over" block. |
|
134
|
|
|
|
|
|
|
# |
|
135
|
|
|
|
|
|
|
sub _start_Para { |
|
136
|
|
|
|
|
|
|
|
|
137
|
26
|
|
|
26
|
|
32
|
my $self = shift; |
|
138
|
26
|
|
|
|
|
27
|
my $indent_level = $self->{_item_indent}; |
|
139
|
|
|
|
|
|
|
|
|
140
|
26
|
100
|
|
|
|
48
|
if ( $self->{_in_over_block} ) { |
|
141
|
1
|
|
|
|
|
4
|
$self->_append( ' ' x $indent_level ); |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
26
|
100
|
|
|
|
56
|
if ( $self->{_moinmoin_list} ) { |
|
145
|
4
|
100
|
66
|
|
|
20
|
if ( not $self->{_in_over_text} and $self->{_moinmoin_list} == 1 ) { |
|
146
|
2
|
|
|
|
|
5
|
$self->_append( "\n" ); |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
4
|
50
|
33
|
|
|
9
|
if ( $self->{_in_over_text} and $self->{_moinmoin_list} == 2 ) { |
|
150
|
0
|
|
|
|
|
0
|
$self->_append( "\n" ); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
4
|
50
|
33
|
|
|
9
|
if ( not( $self->{_in_over_text} and $self->{_moinmoin_list} == 1 ) ) { |
|
154
|
4
|
|
|
|
|
9
|
$self->_append( ' ' x $indent_level ); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
4
|
|
|
|
|
9
|
$self->{_moinmoin_list}++; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
__END__ |