aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-03-24 15:10:58 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-03-24 15:10:58 +0000
commitbbb0b3e72f6a3ffaac8343fc847800d7faaa7573 (patch)
treee14c3599c78123ed6740b0352b2fe45401ceb5b4 /IkiWiki
parentdc0bf7982fa35362ac7e750640323891c7268ed2 (diff)
downloadikiwiki-bbb0b3e72f6a3ffaac8343fc847800d7faaa7573.tar
ikiwiki-bbb0b3e72f6a3ffaac8343fc847800d7faaa7573.tar.gz
* Finally fixed the longstanding inline removal bug.
* Renamed %oldpagemtime to a more accurately named %pagemtime and fix it to actually store pages' mtimes. * Add "mtime" sort parameter to inline plugin.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm7
-rw-r--r--IkiWiki/Render.pm14
2 files changed, 14 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 3a2e0a05f..dcaaa21eb 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -96,6 +96,9 @@ sub preprocess_inline (@) { #{{{
if (exists $params{sort} && $params{sort} eq 'title') {
@list=sort @list;
}
+ elsif (exists $params{sort} && $params{sort} eq 'mtime') {
+ @list=sort { $pagemtime{$b} <=> $pagemtime{$a} } @list;
+ }
elsif (! exists $params{sort} || $params{sort} eq 'age') {
@list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
}
@@ -116,6 +119,10 @@ sub preprocess_inline (@) { #{{{
}
add_depends($params{page}, $params{pages});
+ # Explicitly add all currently displayed pages as dependencies, so
+ # that if they are removed or otherwise changed, the inline will be
+ # sure to be updated.
+ add_depends($params{page}, join(" or ", @list));
my $rssurl=rsspage(basename($params{page}));
my $atomurl=atompage(basename($params{page}));
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 990b803de..c5d885810 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -192,7 +192,6 @@ sub render ($) { #{{{
writefile(htmlpage($page), $config{destdir},
genpage($page, $content, mtime($srcfile)));
- $oldpagemtime{$page}=time;
}
else {
my $srcfd=readfile($srcfile, 1, 1);
@@ -218,7 +217,6 @@ sub render ($) { #{{{
}
}
});
- $oldpagemtime{$file}=time;
}
} #}}}
@@ -294,7 +292,7 @@ sub refresh () { #{{{
foreach my $file (@files) {
my $page=pagename($file);
$pagesources{$page}=$file;
- if (! $oldpagemtime{$page}) {
+ if (! $pagemtime{$page}) {
push @add, $file;
$pagecase{lc $page}=$page;
if ($config{getctime} && -e "$config{srcdir}/$file") {
@@ -306,13 +304,13 @@ sub refresh () { #{{{
}
}
my @del;
- foreach my $page (keys %oldpagemtime) {
+ foreach my $page (keys %pagemtime) {
if (! $exists{$page}) {
debug(sprintf(gettext("removing old page %s"), $page));
push @del, $pagesources{$page};
$links{$page}=[];
$renderedfiles{$page}=[];
- $oldpagemtime{$page}=0;
+ $pagemtime{$page}=0;
prune($config{destdir}."/".$_)
foreach @{$oldrenderedfiles{$page}};
delete $pagesources{$page};
@@ -324,10 +322,12 @@ sub refresh () { #{{{
foreach my $file (@files) {
my $page=pagename($file);
- if (! exists $oldpagemtime{$page} ||
- mtime(srcfile($file)) > $oldpagemtime{$page} ||
+ my $mtime=mtime(srcfile($file));
+ if (! exists $pagemtime{$page} ||
+ $mtime > $pagemtime{$page} ||
$forcerebuild{$page}) {
debug(sprintf(gettext("scanning %s"), $file));
+ $pagemtime{$page}=$mtime;
push @changed, $file;
scan($file);
}