diff options
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 10 | ||||
-rw-r--r-- | IkiWiki/Plugin/linkmap.pm | 6 | ||||
-rw-r--r-- | IkiWiki/Plugin/search.pm | 3 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 33 |
4 files changed, 23 insertions, 29 deletions
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(); diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 48a25bef7..deec539ae 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -113,17 +113,6 @@ sub genpage ($$$) { #{{{ return $content; } #}}} -sub check_overwrite ($$) { #{{{ - # Important security check. Make sure to call this before saving - # any files to the source directory. - my $dest=shift; - my $src=shift; - - if (! exists $renderedfiles{$src} && -e $dest && ! $config{rebuild}) { - error("$dest already exists and was not rendered from $src before"); - } -} #}}} - sub mtime ($) { #{{{ my $file=shift; @@ -157,6 +146,7 @@ sub render ($) { #{{{ my $content=readfile($srcfile); my $page=pagename($file); delete $depends{$page}; + will_render($page, htmlpage($page), 1); $content=filter($page, $content); @@ -166,20 +156,17 @@ sub render ($) { #{{{ $content=linkify($page, $page, $content); $content=htmlize($page, $type, $content); - check_overwrite("$config{destdir}/".htmlpage($page), $page); writefile(htmlpage($page), $config{destdir}, genpage($page, $content, mtime($srcfile))); $oldpagemtime{$page}=time; - $renderedfiles{$page}=htmlpage($page); } else { my $content=readfile($srcfile, 1); $links{$file}=[]; delete $depends{$file}; - check_overwrite("$config{destdir}/$file", $file); + will_render($file, $file, 1); writefile($file, $config{destdir}, $content, 1); $oldpagemtime{$file}=time; - $renderedfiles{$file}=$file; } } #}}} @@ -269,9 +256,10 @@ sub refresh () { #{{{ if (! $exists{$page}) { debug("removing old page $page"); push @del, $pagesources{$page}; - prune($config{destdir}."/".$renderedfiles{$page}); - delete $renderedfiles{$page}; + $renderedfiles{$page}=[]; $oldpagemtime{$page}=0; + prune($config{destdir}."/".$_) + foreach @{$oldrenderedfiles{$page}}; delete $pagesources{$page}; } } @@ -366,6 +354,17 @@ FILE: foreach my $file (@files) { } } + # Remove no longer rendered files. + foreach my $src (keys %rendered) { + my $page=pagename($src); + foreach my $file (@{$oldrenderedfiles{$page}}) { + if (! grep { $_ eq $file } @{$renderedfiles{$page}}) { + debug("removing $file, no longer rendered by $page"); + prune($config{destdir}."/".$file); + } + } + } + if (@del) { run_hooks(delete => sub { shift->(@del) }); } |