Debian Codegraph @

IkiWiki/Plugin/pagetemplate.pm

raw symbols SCIP
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::pagetemplatescip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/;
3
4 use warningsscip-perl cpan perl-project 0.0.0 warnings/;
5 use strictscip-perl cpan perl-project 0.0.0 strict/;
6 use IkiWiki 3.00scip-perl cpan perl-project 0.0.0 `IkiWiki 3.00`/;
7
8 my %templates;
9
10 sub importscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/import(). {
11 hookscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/hook().(type => "getsetup", id => "pagetemplate", call => \&getsetupscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/getsetup().);
12 hookscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/hook().(type => "preprocess", id => "pagetemplate", call => \&preprocessscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/preprocess().);
13 hookscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/hook().(type => "templatefile", id => "pagetemplate", call => \&templatefilescip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/templatefile().);
14 }
15
16 sub getsetupscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/getsetup(). () {
17 return
18 plugin => {
19 safe => 1,
20 rebuild => undef,
21 },
22 }
23
24 sub preprocessscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/preprocess(). (@) {
25 my %params=@_scip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/`@_`.;
26
27 if (! existsscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/exists(). $params{template} ||
28 $params{template} !~ /^[-A-Za-z0-9._+]+$/ ||
29 ! definedscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/defined(). IkiWiki::template_filescip-perl cpan perl-project 0.0.0 IkiWiki/template_file().($params{template})) {
30 errorscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/error(). gettextscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/gettext().("bad or missing template")
31 }
32
33 if ($params{page} eq $params{destpage}) {
34 $templates{$params{page}}=$params{template};
35 }
36
37 return "";
38 }
39
40 sub templatefilescip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/templatefile(). (@) {
41 my %params=@_scip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/`@_`.;
42
43 if (existsscip-perl cpan perl-project 0.0.0 IkiWiki/Plugin/pagetemplate/exists(). $templates{$params{page}}) {
44 return $templates{$params{page}};
45 }
46
47 return undef;
48 }
49
50 1