line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::WikiCreole; |
2
|
1
|
|
|
1
|
|
84048
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
18
|
use base 'Template::Plugin::Filter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1043
|
|
6
|
1
|
|
|
1
|
|
21463
|
use Text::WikiCreole; |
|
1
|
|
|
|
|
12765
|
|
|
1
|
|
|
|
|
335
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Template::Plugin::WikiCreole - TT wrapper for L |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
[% USE WikiCreole %] |
17
|
|
|
|
|
|
|
[% FILTER $WikiCreole %] |
18
|
|
|
|
|
|
|
... |
19
|
|
|
|
|
|
|
[% END %] |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This is a plugin used for Wiki Creole rendering inside Template Toolkit. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
[% USE WikiCreole %] |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
At this time none of the methods for customising L are |
28
|
|
|
|
|
|
|
not directly available via L. However |
29
|
|
|
|
|
|
|
Text:WikiCreole is an exporter and its methods act |
30
|
|
|
|
|
|
|
globaly. So you can use this class in your software and call its methods to |
31
|
|
|
|
|
|
|
change the behavour in the template. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
I have found this most useful when teamed with ttree. It gives me a way to |
34
|
|
|
|
|
|
|
maintain the static part of a website in WikiCreole. I find it quicker to write |
35
|
|
|
|
|
|
|
and maintain most pages in WikiCreole. This ensures I end up with a constant |
36
|
|
|
|
|
|
|
style. (I have never liked HTML editors.) |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
For example the following ttree configuration: |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
src = src |
41
|
|
|
|
|
|
|
dest = ~/site-prefview |
42
|
|
|
|
|
|
|
lib = template/ |
43
|
|
|
|
|
|
|
template_process = layout.html |
44
|
|
|
|
|
|
|
depend = *=navigation.wiki,footer.wiki |
45
|
|
|
|
|
|
|
suffix = wiki=html |
46
|
|
|
|
|
|
|
ignore = ^navigation.wiki$ |
47
|
|
|
|
|
|
|
ignore = ^footer.wiki$ |
48
|
|
|
|
|
|
|
ignore = \b(CVS|RCS)\b |
49
|
|
|
|
|
|
|
ignore = ^\. |
50
|
|
|
|
|
|
|
ignore = ~$ |
51
|
|
|
|
|
|
|
ignore = ^# |
52
|
|
|
|
|
|
|
ignore = \.tiff$ |
53
|
|
|
|
|
|
|
copy = \.png$ |
54
|
|
|
|
|
|
|
copy = \.gif$ |
55
|
|
|
|
|
|
|
copy = \.css$ |
56
|
|
|
|
|
|
|
... |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
and the following template: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
[% USE WikiCreole -%] |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Change of Plan - [% template.name %] |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
[% INCLUDE header.wiki | $WikiCreole %] |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
[% INCLUDE navigation.wiki | $WikiCreole %] |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
[% PROCESS $template | $WikiCreole %] |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
[% INCLUDE footer.wiki | $WikiCreole %] |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
will create a webpage for every wiki template in the src directory with same |
90
|
|
|
|
|
|
|
layout and style (look and feel). The variation between pages is the content, |
91
|
|
|
|
|
|
|
the with the full expressive power of WikiCreole. The css file provides |
92
|
|
|
|
|
|
|
considerable flexability in the look. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This source itself is a blatant copy of L by |
95
|
|
|
|
|
|
|
Ivor Williams |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 METHODS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 filter |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Accepts the wiki text to be rendered, and context. See |
102
|
|
|
|
|
|
|
L. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub filter { |
107
|
2
|
|
|
2
|
1
|
3859
|
my ( $self, $text ) = @_; |
108
|
|
|
|
|
|
|
|
109
|
2
|
|
|
|
|
7
|
my $conf = $self->{_CONFIG}; |
110
|
2
|
|
50
|
|
|
11
|
$conf ||= {}; |
111
|
2
|
|
|
|
|
8
|
my %tags = %$conf; |
112
|
2
|
|
|
|
|
4
|
my %opts; |
113
|
2
|
|
|
|
|
4
|
my %default = ( # Consider and ther how best to do them |
114
|
|
|
|
|
|
|
); |
115
|
2
|
|
|
|
|
8
|
for ( keys %default ) { |
116
|
0
|
|
0
|
|
|
0
|
$opts{$_} = $tags{$_} || $default{$_}; |
117
|
0
|
|
|
|
|
0
|
delete $tags{$_}; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
|
|
11
|
my $output = creole_parse( $text, \%tags ); |
121
|
|
|
|
|
|
|
|
122
|
2
|
|
|
|
|
13968
|
return $output; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 BUGS |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Please use http://rt.cpan.org for reporting any bugs. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 TODO |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Create arguments to pass |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 AUTHOR |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Martin Ellis |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 COPYRIGHT |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This program is free software; you can redistribute |
140
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The full text of the license can be found in the |
143
|
|
|
|
|
|
|
LICENSE file included with this module. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SEE ALSO |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
L |
149
|
|
|
|
|
|
|
L |
150
|
|
|
|
|
|
|
L |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
#################### main pod documentation end ################### |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
# The preceding line will help the module return a true value |
159
|
|
|
|
|
|
|
|