summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/po.pm
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-12-31 22:27:12 +0100
committerintrigeri <intrigeri@boum.org>2009-01-01 01:08:10 +0100
commit85f865b5d98e0122934d11e3f3eb6703e4f4c620 (patch)
treef0d408b3facc58cfb295fea2057db9a070d88fd8 /IkiWiki/Plugin/po.pm
parentbbeb9a4a1462ef17cfc1faeaf3bb73eb6384bdab (diff)
po: added postscan hook, to make pages depend on the pages linking to them
... so that nicepagetitle hook's effects, such as translation status displayed in links, are updated when the linked page changes. The replacement of 'my %backlinks' with 'our %backlinks' in Render.pm made this work: previously, every postscan hook was called with an almost empty %backlinks, which defeated all my attempts to implement this feature. This feature hits performance a bit. Its cost was quite small in my real-world use-cases (a few percents bigger refresh time), but could be bigger in worst cases. Time will tell. NB: this hack could also be used by my meta branch. It may even be a ikiwiki optional feature. Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki/Plugin/po.pm')
-rw-r--r--IkiWiki/Plugin/po.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 33bc2b057..c529828d6 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -35,6 +35,7 @@ sub import { #{{{
hook(type => "filter", id => "po", call => \&filter);
hook(type => "htmlize", id => "po", call => \&htmlize);
hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
+ hook(type => "postscan", id => "po", call => \&postscan);
hook(type => "rename", id => "po", call => \&renamepages);
hook(type => "delete", id => "po", call => \&mydelete);
hook(type => "change", id => "po", call => \&change);
@@ -340,6 +341,16 @@ sub pagetemplate (@) { #{{{
}
} # }}}
+sub postscan (@) {
+ my %params = @_;
+ my $page = $params{page};
+
+ # backlinks involve back-dependencies, so that nicepagetitle effects,
+ # such as translation status displayed in links, are updated
+ use IkiWiki::Render;
+ map add_depends($page, $_), keys %{$IkiWiki::backlinks{$page}};
+}
+
# Add the renamed page translations to the list of to-be-renamed pages.
# Save information about master page rename, so that:
# - our delete hook can ignore the translations not renamed already