* 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.master
parent
dc0bf7982f
commit
bbb0b3e72f
10
IkiWiki.pm
10
IkiWiki.pm
|
@ -8,7 +8,7 @@ use HTML::Entities;
|
|||
use URI::Escape q{uri_escape_utf8};
|
||||
use open qw{:utf8 :std};
|
||||
|
||||
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %pagecase
|
||||
use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
|
||||
%renderedfiles %oldrenderedfiles %pagesources %depends %hooks
|
||||
%forcerebuild $gettext_obj};
|
||||
|
||||
|
@ -672,7 +672,7 @@ sub loadindex () { #{{{
|
|||
my $page=pagename($items{src}[0]);
|
||||
if (! $config{rebuild}) {
|
||||
$pagesources{$page}=$items{src}[0];
|
||||
$oldpagemtime{$page}=$items{mtime}[0];
|
||||
$pagemtime{$page}=$items{mtime}[0];
|
||||
$oldlinks{$page}=[@{$items{link}}];
|
||||
$links{$page}=[@{$items{link}}];
|
||||
$depends{$page}=$items{depends}[0] if exists $items{depends};
|
||||
|
@ -694,9 +694,9 @@ sub saveindex () { #{{{
|
|||
my $newfile="$config{wikistatedir}/index.new";
|
||||
my $cleanup = sub { unlink($newfile) };
|
||||
open (OUT, ">$newfile") || error("cannot write to $newfile: $!", $cleanup);
|
||||
foreach my $page (keys %oldpagemtime) {
|
||||
next unless $oldpagemtime{$page};
|
||||
my $line="mtime=$oldpagemtime{$page} ".
|
||||
foreach my $page (keys %pagemtime) {
|
||||
next unless $pagemtime{$page};
|
||||
my $line="mtime=$pagemtime{$page} ".
|
||||
"ctime=$pagectime{$page} ".
|
||||
"src=$pagesources{$page}";
|
||||
$line.=" dest=$_" foreach @{$renderedfiles{$page}};
|
||||
|
|
|
@ -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}));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,12 @@ ikiwiki (1.48) UNRELEASED; urgency=low
|
|||
* Make ikiwiki's stylesheet support printing by hiding parts of the page
|
||||
that shouldn't appear in a printout: Search box, actions bar,
|
||||
blog post form, tags, backlinks, and feed buttons.
|
||||
* 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.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Wed, 21 Mar 2007 19:46:32 -0400
|
||||
-- Joey Hess <joeyh@debian.org> Fri, 23 Mar 2007 16:16:39 -0400
|
||||
|
||||
ikiwiki (1.47) unstable; urgency=low
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
recently fixed [[bugs]]
|
||||
|
||||
[[inline pages="link(bugs/done) and !bugs and !*/Discussion" show="10"]]
|
||||
[[inline pages="link(bugs/done) and !bugs and !*/Discussion" sort=mtime show=10]]
|
||||
|
|
|
@ -6,27 +6,4 @@ This only happens if the page is removed from the inlined pagespec due to
|
|||
a tag changing; the problem is that once the tag is changed, ikiwiki does
|
||||
not know that the page used to match before.
|
||||
|
||||
Another example would be a pagespec that allowed only matching new pages:
|
||||
|
||||
newer(1 day)
|
||||
|
||||
Obviously, the pages that matches are going to change, and again once they
|
||||
do, ikiwiki will no longer know that they matched before, so it won't know
|
||||
to remove them from a page that used that to inline them.
|
||||
|
||||
To fix, seems I would need to record the actual list of pages that are
|
||||
currently included on an inline page, and do a comparison to see if any
|
||||
have changed.
|
||||
|
||||
At first I thought, why not just add them to the dependencies
|
||||
explicitly, but that failed because the dependencies GlobList failed to match
|
||||
when a negated expression like "!tag(bugs/done)" is matched. It is,
|
||||
however, doable with PageSpecs:
|
||||
|
||||
(real deps here) or (list of all currently inlined pages here)
|
||||
|
||||
However, it's not really clear to me how to _remove_ inlined pages from the
|
||||
deps when they stop being inlined for whatever reason. So a separate list
|
||||
would be better.
|
||||
|
||||
So this is blocked by [[todo/plugin_data_storage]] I suppose.
|
||||
[[done]]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
recently fixed [[bugs]]
|
||||
|
||||
[[inline pages="./* and link(./done) and !*/Discussion" show=10]]
|
||||
[[inline pages="./* and link(./done) and !*/Discussion" sort=mtime show=10]]
|
||||
|
|
|
@ -52,5 +52,6 @@ directive:
|
|||
for editing and discussion (if they would be shown at the top of the page
|
||||
itself).
|
||||
* `sort` - Controls how inlined pages are sorted. The default, "age" is to
|
||||
sort newest pages first. Setting it to "title" will sort pages by title.
|
||||
sort newest created pages first. Setting it to "title" will sort pages by
|
||||
title, and "mtime" sorts most recently modified pages first.
|
||||
* `reverse` - If set to "yes", causes the sort order to be reversed.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
recently fixed [[TODO]] items
|
||||
|
||||
[[inline pages="link(todo/done) and !todo and !*/Discussion" show="10"]]
|
||||
[[inline pages="link(todo/done) and !todo and !*/Discussion" sort=mtime show=10]]
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2007-03-21 18:59-0400\n"
|
||||
"POT-Creation-Date: 2007-03-23 16:36-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -30,7 +30,7 @@ msgid "%s is not an editable page"
|
|||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/CGI.pm:418 ../IkiWiki/Plugin/brokenlinks.pm:24
|
||||
#: ../IkiWiki/Plugin/inline.pm:174 ../IkiWiki/Plugin/opendiscussion.pm:17
|
||||
#: ../IkiWiki/Plugin/inline.pm:181 ../IkiWiki/Plugin/opendiscussion.pm:17
|
||||
#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:97
|
||||
#: ../IkiWiki/Render.pm:165
|
||||
msgid "discussion"
|
||||
|
@ -147,21 +147,21 @@ msgstr ""
|
|||
msgid "Must specify url to wiki with --url when using --rss or --atom"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Plugin/inline.pm:103
|
||||
#: ../IkiWiki/Plugin/inline.pm:106
|
||||
#, perl-format
|
||||
msgid "unknown sort type %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Plugin/inline.pm:145
|
||||
#: ../IkiWiki/Plugin/inline.pm:152
|
||||
#, perl-format
|
||||
msgid "nonexistant template %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Plugin/inline.pm:182 ../IkiWiki/Render.pm:101
|
||||
#: ../IkiWiki/Plugin/inline.pm:189 ../IkiWiki/Render.pm:101
|
||||
msgid "Discussion"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Plugin/inline.pm:397
|
||||
#: ../IkiWiki/Plugin/inline.pm:404
|
||||
msgid "RPC::XML::Client not found, not pinging"
|
||||
msgstr ""
|
||||
|
||||
|
@ -420,17 +420,17 @@ msgid ""
|
|||
"notifications"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Render.pm:251 ../IkiWiki/Render.pm:271
|
||||
#: ../IkiWiki/Render.pm:249 ../IkiWiki/Render.pm:269
|
||||
#, perl-format
|
||||
msgid "skipping bad filename %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Render.pm:311
|
||||
#: ../IkiWiki/Render.pm:309
|
||||
#, perl-format
|
||||
msgid "removing old page %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Render.pm:330
|
||||
#: ../IkiWiki/Render.pm:329
|
||||
#, perl-format
|
||||
msgid "scanning %s"
|
||||
msgstr ""
|
||||
|
|
Loading…
Reference in New Issue