From 10b8557946c7a5e4ef2210ac448365ffc6174f81 Mon Sep 17 00:00:00 2001 From: joey Date: Fri, 2 Mar 2007 04:00:42 +0000 Subject: * Add "template" option to inline plugin to allow for use of customised templates. --- IkiWiki/Plugin/inline.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'IkiWiki') 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}; -- cgit v1.2.3