aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-03-02 04:00:42 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-03-02 04:00:42 +0000
commit10b8557946c7a5e4ef2210ac448365ffc6174f81 (patch)
tree65f2f118548261e257c060d8cd2e30c8258d3ea0 /IkiWiki/Plugin
parent50b2e080e021752c9c5933fca770fbead5711e78 (diff)
downloadikiwiki-10b8557946c7a5e4ef2210ac448365ffc6174f81.tar
ikiwiki-10b8557946c7a5e4ef2210ac448365ffc6174f81.tar.gz
* Add "template" option to inline plugin to allow for use of customised
templates.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/inline.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index ebfcee9ed..2db39f777 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -77,6 +77,12 @@ sub preprocess_inline (@) { #{{{
$desc = $config{wikiname};
}
my $actions=yesno($params{actions});
+ if (exists $params{template}) {
+ $params{template}=~s/[^-_a-zA-Z0-9]+//g;
+ }
+ else {
+ $params{template} = $archive ? "archivepage" : "inlinepage";
+ }
my @list;
foreach my $page (keys %pagesources) {
@@ -131,10 +137,11 @@ sub preprocess_inline (@) { #{{{
$ret.=$linktemplate->output;
}
- my $template=template(
- ($archive ? "inlinepagetitle.tmpl" : "inlinepage.tmpl"),
- blind_cache => 1,
- ) unless $raw;
+ my @params=IkiWiki::template_params($params{template}.".tmpl", blind_cache => 1);
+ if (! @params) {
+ return sprintf(gettext("nonexistant template %s @params"), $params{template});
+ }
+ my $template=HTML::Template->new(@params) unless $raw;
foreach my $page (@list) {
my $file = $pagesources{$page};