line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This module is for debugging only |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package IkiWiki; |
7
|
8
|
|
|
8
|
|
38
|
use warnings; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
243
|
|
8
|
8
|
|
|
8
|
|
37
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
210
|
|
9
|
8
|
|
|
8
|
|
6794
|
use Encode; |
|
8
|
|
|
|
|
102735
|
|
|
8
|
|
|
|
|
2390
|
|
10
|
8
|
|
|
8
|
|
6443
|
use HTML::Entities; |
|
8
|
|
|
|
|
370650
|
|
|
8
|
|
|
|
|
919
|
|
11
|
8
|
|
|
8
|
|
6263
|
use URI::Escape q{uri_escape_utf8}; |
|
8
|
|
|
|
|
9987
|
|
|
8
|
|
|
|
|
480
|
|
12
|
8
|
|
|
8
|
|
6695
|
use POSIX; |
|
8
|
|
|
|
|
52478
|
|
|
8
|
|
|
|
|
56
|
|
13
|
8
|
|
|
8
|
|
29295
|
use IO::File; |
|
8
|
|
|
|
|
60754
|
|
|
8
|
|
|
|
|
1823
|
|
14
|
|
|
|
|
|
|
|
15
|
8
|
|
|
8
|
|
11220
|
use HTML::Template; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase |
18
|
|
|
|
|
|
|
%pagestate %renderedfiles %oldrenderedfiles %pagesources |
19
|
|
|
|
|
|
|
%destsources %depends %hooks %forcerebuild $gettext_obj}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Exporter q{import}; |
22
|
|
|
|
|
|
|
our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match |
23
|
|
|
|
|
|
|
bestlink htmllink readfile writefile pagetype srcfile pagename |
24
|
|
|
|
|
|
|
displaytime will_render gettext urlto targetpage |
25
|
|
|
|
|
|
|
add_underlay |
26
|
|
|
|
|
|
|
%config %links %pagestate %renderedfiles |
27
|
|
|
|
|
|
|
%pagesources %destsources); |
28
|
|
|
|
|
|
|
our $VERSION = 2.00; # plugin interface version, next is ikiwiki version |
29
|
|
|
|
|
|
|
our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
### Global configuration |
32
|
|
|
|
|
|
|
# Setting a minimal ikiwiki setup |
33
|
|
|
|
|
|
|
our %config = ( |
34
|
|
|
|
|
|
|
wikiname => "MyWiki", |
35
|
|
|
|
|
|
|
#adminuser => ["yourname", ], |
36
|
|
|
|
|
|
|
adminemail => 'me@example.org', |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Be sure to customise these.. |
39
|
|
|
|
|
|
|
srcdir => "/path/to/source", |
40
|
|
|
|
|
|
|
destdir => "/var/www/wiki", |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
url => "http://example.org/wiki", |
43
|
|
|
|
|
|
|
cgiurl => "http://example.org/ikiwiki.cgi", |
44
|
|
|
|
|
|
|
#templatedir => "/usr/share/ikiwiki/templates", |
45
|
|
|
|
|
|
|
underlaydir => ".", |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
userdir => 'users', |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
wrappers => [ |
50
|
|
|
|
|
|
|
], |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Generate rss feeds for blogs? |
53
|
|
|
|
|
|
|
rss => 1, |
54
|
|
|
|
|
|
|
# Generate atom feeds for blogs? |
55
|
|
|
|
|
|
|
atom => 1, |
56
|
|
|
|
|
|
|
# Include discussion links on all pages? |
57
|
|
|
|
|
|
|
discussion => 1, |
58
|
|
|
|
|
|
|
# Logging settings: |
59
|
|
|
|
|
|
|
verbose => 0, |
60
|
|
|
|
|
|
|
syslog => 0, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
### dummy subroutines |
64
|
|
|
|
|
|
|
sub hook { |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub debug { |
69
|
|
|
|
|
|
|
if ($IkiWiki::debug) { |
70
|
|
|
|
|
|
|
print STDERR shift,"\n"; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub error { |
75
|
|
|
|
|
|
|
die @_; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub readfile { |
79
|
|
|
|
|
|
|
my $file = shift; |
80
|
|
|
|
|
|
|
my $content = undef; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
if (my $fh = IO::File->new( $file )) { |
83
|
|
|
|
|
|
|
local $/; |
84
|
|
|
|
|
|
|
$content = <$fh>; |
85
|
|
|
|
|
|
|
$fh->close; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
return $content; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub srcfile { |
92
|
|
|
|
|
|
|
my $page = shift; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
return $page; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my %tmpl = (); |
98
|
|
|
|
|
|
|
my %tmpl_options = ( |
99
|
|
|
|
|
|
|
die_on_bad_params => 0, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub template { |
103
|
|
|
|
|
|
|
my $name = shift; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
if (not defined $tmpl{$name}) { |
106
|
|
|
|
|
|
|
my $filename = sprintf 'extras/%s', $name; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
$tmpl{$name} = HTML::Template->new( filename => $filename, |
109
|
|
|
|
|
|
|
%tmpl_options ); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
return $tmpl{$name}; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub add_depends { |
116
|
|
|
|
|
|
|
return; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub gettext { |
120
|
|
|
|
|
|
|
return shift; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub urlto { |
124
|
|
|
|
|
|
|
my ($to, $from) = @_; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
return sprintf( "URL from %s to %s", $from || '', $to || '' ); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|