summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm16
-rw-r--r--IkiWiki/Plugin/inline.pm19
-rw-r--r--IkiWiki/Plugin/search.pm4
-rw-r--r--IkiWiki/Rcs/git.pm4
-rw-r--r--IkiWiki/Rcs/svn.pm4
-rw-r--r--IkiWiki/Render.pm7
6 files changed, 21 insertions, 33 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index e02ab62a6..d069de8dc 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -33,11 +33,7 @@ sub cgi_recentchanges ($) { #{{{
unlockwiki();
- # Force reading the template as utf-8, necessary if
- # rcs_recentchanges returns true utf-8 strings.
- require Encode;
- my $template=HTML::Template->new(filter => \&Encode::decode_utf8,
- filename => "$config{templatedir}/recentchanges.tmpl");
+ my $template=template("recentchanges.tmpl");
$template->param(
title => "RecentChanges",
indexlink => indexlink(),
@@ -72,7 +68,7 @@ sub cgi_signin ($$) { #{{{
action => $config{cgiurl},
header => 0,
template => (-e "$config{templatedir}/signin.tmpl" ?
- "$config{templatedir}/signin.tmpl" : ""),
+ {template_params("signin.tmpl")} : ""),
stylesheet => styleurl(),
);
@@ -185,9 +181,7 @@ sub cgi_signin ($$) { #{{{
}
elsif ($form->submitted eq 'Mail Password') {
my $user_name=$form->field("name");
- my $template=HTML::Template->new(
- filename => "$config{templatedir}/passwordmail.tmpl"
- );
+ my $template=template("passwordmail.tmpl");
$template->param(
user_name => $user_name,
user_password => userinfo_get($user_name, "password"),
@@ -239,7 +233,7 @@ sub cgi_prefs ($$) { #{{{
params => $q,
action => $config{cgiurl},
template => (-e "$config{templatedir}/prefs.tmpl" ?
- "$config{templatedir}/prefs.tmpl" : ""),
+ {template_params("prefs.tmpl")} : ""),
stylesheet => styleurl(),
);
my @buttons=("Save Preferences", "Logout", "Cancel");
@@ -308,7 +302,7 @@ sub cgi_editpage ($$) { #{{{
params => $q,
action => $config{cgiurl},
table => 0,
- template => "$config{templatedir}/editpage.tmpl"
+ template => {template_params("editpage.tmpl")},
);
my @buttons=("Save Page", "Preview", "Cancel");
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 05563b946..afff96cee 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -40,8 +40,7 @@ sub preprocess_inline (@) { #{{{
if (exists $params{rootpage}) {
# Add a blog post form, with a rss link button.
- my $formtemplate=HTML::Template->new(blind_cache => 1,
- filename => "$config{templatedir}/blogpost.tmpl");
+ my $formtemplate=template("blogpost.tmpl", blind_cache => 1);
$formtemplate->param(cgiurl => $config{cgiurl});
$formtemplate->param(rootpage => $params{rootpage});
if ($config{rss}) {
@@ -51,16 +50,17 @@ sub preprocess_inline (@) { #{{{
}
elsif ($config{rss}) {
# Add a rss link button.
- my $linktemplate=HTML::Template->new(blind_cache => 1,
- filename => "$config{templatedir}/rsslink.tmpl");
+ my $linktemplate=template("rsslink.tmpl", blind_cache => 1);
$linktemplate->param(rssurl => rsspage(basename($params{page})));
$ret.=$linktemplate->output;
}
- my $template=HTML::Template->new(blind_cache => 1,
- filename => (($params{archive} eq "no")
- ? "$config{templatedir}/inlinepage.tmpl"
- : "$config{templatedir}/inlinepagetitle.tmpl"));
+ my $template=template(
+ (($params{archive} eq "no")
+ ? "inlinepage.tmpl"
+ : "inlinepagetitle.tmpl"),
+ blind_cache => 1,
+ );
my @pages;
foreach my $page (blog_list($params{pages}, $params{show})) {
@@ -146,8 +146,7 @@ sub genrss ($@) { #{{{
my $url="$config{url}/".htmlpage($page);
- my $template=HTML::Template->new(blind_cache => 1,
- filename => "$config{templatedir}/rsspage.tmpl");
+ my $template=template("rsspage.tmpl", blind_cache => 1);
my @items;
foreach my $p (@pages) {
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index c94974ac4..94b37ca06 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -87,9 +87,7 @@ sub estcfg () { #{{{
close TEMPLATE;
open(TEMPLATE, ">$estdir/$cgi.conf") ||
error("write $estdir/$cgi.conf: $!");
- my $template=HTML::Template->new(
- filename => "$config{templatedir}/estseek.conf"
- );
+ my $template=template("estseek.conf");
eval q{use Cwd 'abs_path'};
$template->param(
index => $estdir,
diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm
index f29ffa162..636eb57f5 100644
--- a/IkiWiki/Rcs/git.pm
+++ b/IkiWiki/Rcs/git.pm
@@ -449,9 +449,7 @@ sub rcs_notify () { #{{{
}
$subject .= " by $user";
- my $template = HTML::Template->new(
- filename => "$config{templatedir}/notifymail.tmpl"
- );
+ my $template = template("notifymail.tmpl");
$template->param(
wikiname => $config{wikiname},
diff => $diff,
diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm
index 42ded0cea..be4106a02 100644
--- a/IkiWiki/Rcs/svn.pm
+++ b/IkiWiki/Rcs/svn.pm
@@ -202,9 +202,7 @@ sub rcs_notify () { #{{{
}
$subject.=" by $user";
- my $template=HTML::Template->new(
- filename => "$config{templatedir}/notifymail.tmpl"
- );
+ my $template=template("notifymail.tmpl");
$template->param(
wikiname => $config{wikiname},
diff => $diff,
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 54e409040..3be8e1c53 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -25,11 +25,13 @@ sub htmlize ($$) { #{{{
my $content=shift;
if (! $INC{"/usr/bin/markdown"}) {
+ # Note: a proper perl module is available in Debian
+ # for markdown, but not upstream yet.
no warnings 'once';
$blosxom::version="is a proper perl module too much to ask?";
use warnings 'all';
do "/usr/bin/markdown";
- use Encode;
+ require Encode;
}
if ($type eq '.mdwn') {
@@ -171,8 +173,7 @@ sub genpage ($$$) { #{{{
my $title=pagetitle(basename($page));
- my $template=HTML::Template->new(blind_cache => 1,
- filename => "$config{templatedir}/page.tmpl");
+ my $template=template("page.tmpl", blind_cache => 1);
my $actions=0;
if (length $config{cgiurl}) {