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