From cefbe6210f4e89984bb40062e4f9787b7372dd52 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 8 Oct 2006 21:56:50 +0000 Subject: * Change %renderedfiles to store an array of files rendered from a given source file, to allow tracking of extra rendered files like rss feeds. * Note that plugins that accessed this variable will need to be updated! The plugin interface has been increased to version 1.01 for this change. * Add will_render function to the plugin interface, used to register that a page renders a destination file, and do some security checks. * Use will_render in the inline and linkmap plugins. * Previously but no longer rendered files will be cleaned up. * You will need to rebuild your wiki on upgrade to this version. --- IkiWiki/Plugin/inline.pm | 10 +++------- IkiWiki/Plugin/linkmap.pm | 6 ++---- IkiWiki/Plugin/search.pm | 3 ++- 3 files changed, 7 insertions(+), 12 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 868f3816f..c7cafee12 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::inline; use warnings; use strict; -use IkiWiki; +use IkiWiki 1.00; use IkiWiki::Render; # for displaytime use URI; @@ -154,10 +154,8 @@ sub preprocess_inline (@) { #{{{ } } - # TODO: should really add this to renderedfiles and call - # check_overwrite, but currently renderedfiles - # only supports listing one file per page. if ($config{rss} && $rss) { + will_render($params{page}, rsspage($params{page})); writefile(rsspage($params{page}), $config{destdir}, genrss($desc, $params{page}, @list)); $toping{$params{page}}=1 unless $config{rebuild}; @@ -233,9 +231,7 @@ sub genrss ($$@) { #{{{ my $itemtemplate=template("rssitem.tmpl", blind_cache => 1); my $content=""; foreach my $p (@pages) { - next unless exists $renderedfiles{$p}; - - my $u=URI->new(encode_utf8("$config{url}/$renderedfiles{$p}")); + my $u=URI->new(encode_utf8($config{url}."/".htmlpage($p))); $itemtemplate->param( title => pagetitle(basename($p)), diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 497b1ef43..d7dffc941 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -57,12 +57,10 @@ sub genmap ($) { #{{{ # Use ikiwiki's function to create the file, this makes sure needed # subdirs are there and does some sanity checking. - writefile("$params{page}.png", $config{destdir}, ""); + will_render($params{page}, $params{page}.".png"); + writefile($params{page}.".png", $config{destdir}, ""); # Run dot to create the graphic and get the map data. - # TODO: should really add the png to renderedfiles and call - # check_overwrite, but currently renderedfiles - # only supports listing one file per page. my $pid; my $sigpipe=0;; $SIG{PIPE}=sub { $sigpipe=1 }; diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 5a4dfd491..a57a84048 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -63,7 +63,8 @@ sub change (@) { #{{{ debug("updating hyperestraier search index"); estcmd("gather -cm -bc -cl -sd", map { - Encode::encode_utf8($config{destdir}."/".$renderedfiles{pagename($_)}) + Encode::encode_utf8($config{destdir}."/".$_) + foreach @{$renderedfiles{pagename($_)}}; } @_ ); estcfg(); -- cgit v1.2.3