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
|
|
10
|
use Pod::Simple::Wiki; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
60
|
|
16
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
17
|
2
|
|
|
2
|
|
9
|
use vars qw(@ISA $VERSION); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1248
|
|
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", |
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
|
33
|
my $class = shift; |
58
|
21
|
|
|
|
|
67
|
my $self = Pod::Simple::Wiki->new( 'wiki', @_ ); |
59
|
21
|
|
|
|
|
43
|
$self->{_tags} = $tags; |
60
|
|
|
|
|
|
|
|
61
|
21
|
|
|
|
|
30
|
bless $self, $class; |
62
|
21
|
|
|
|
|
61
|
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
|
|
53
|
my $self = shift; |
75
|
40
|
|
|
|
|
51
|
my $item_type = $_[0]; |
76
|
40
|
|
|
|
|
53
|
my $item_param = $_[1]; |
77
|
40
|
|
|
|
|
54
|
my $indent_level = $self->{_item_indent}; |
78
|
|
|
|
|
|
|
|
79
|
40
|
100
|
|
|
|
117
|
if ( $item_type eq 'bullet' ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
80
|
13
|
|
|
|
|
48
|
$self->_append( ' ' x $indent_level . "* " ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif ( $item_type eq 'number' ) { |
83
|
13
|
|
|
|
|
48
|
$self->_append( ' ' x $indent_level . "1. " ); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
elsif ( $item_type eq 'text' ) { |
86
|
14
|
|
|
|
|
53
|
$self->_append( ' ' x $indent_level ); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
40
|
|
|
|
|
131
|
$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
|
|
491
|
my $self = shift; |
103
|
66
|
|
|
|
|
87
|
my $text = $_[0]; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Split the text into tokens but maintain the whitespace |
106
|
66
|
|
|
|
|
310
|
my @tokens = split /(\s+)/, $text; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Escape any tokens here. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Rejoin the tokens and whitespace. |
111
|
66
|
|
|
|
|
280
|
$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
|
|
41
|
$_[0]->_output( ":: " ); |
126
|
14
|
|
|
|
|
35
|
$_[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
|
|
45
|
my $self = shift; |
138
|
26
|
|
|
|
|
38
|
my $indent_level = $self->{_item_indent}; |
139
|
|
|
|
|
|
|
|
140
|
26
|
100
|
|
|
|
56
|
if ( $self->{_in_over_block} ) { |
141
|
1
|
|
|
|
|
6
|
$self->_append( ' ' x $indent_level ); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
26
|
100
|
|
|
|
85
|
if ( $self->{_moinmoin_list} ) { |
145
|
4
|
100
|
66
|
|
|
28
|
if ( not $self->{_in_over_text} and $self->{_moinmoin_list} == 1 ) { |
146
|
2
|
|
|
|
|
6
|
$self->_append( "\n" ); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
4
|
50
|
33
|
|
|
13
|
if ( $self->{_in_over_text} and $self->{_moinmoin_list} == 2 ) { |
150
|
0
|
|
|
|
|
0
|
$self->_append( "\n" ); |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
4
|
50
|
33
|
|
|
12
|
if ( not( $self->{_in_over_text} and $self->{_moinmoin_list} == 1 ) ) { |
154
|
4
|
|
|
|
|
15
|
$self->_append( ' ' x $indent_level ); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
4
|
|
|
|
|
13
|
$self->{_moinmoin_list}++; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
__END__ |