X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/fcaa7f6237ac2b2b372cb26aed136f8a364d6ed5..58481dcdf623aed8ab840ab86e3ac065c4bcb8a1:/IkiWiki/Plugin/po.pm diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 659350ea0..6f716a91f 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -126,6 +126,13 @@ sub getsetup () { safe => 1, rebuild => 1, }, + po_strictly_refresh_backlinks => { + type => "boolean", + example => 1, + description => "refresh a page when a backlinked page is changed (can hit performance)", + safe => 1, + rebuild => 1, + }, } sub checkconfig () { @@ -166,6 +173,10 @@ sub checkconfig () { ! defined $config{po_translation_status_in_links}) { $config{po_translation_status_in_links}=1; } + if (! exists $config{po_strictly_refresh_backlinks} || + ! defined $config{po_strictly_refresh_backlinks}) { + $config{po_strictly_refresh_backlinks}=1; + } push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/; } @@ -266,7 +277,7 @@ sub pagetemplate (@) { $template->param(percenttranslated => percenttranslated($page)); } if ($template->query(name => "istranslation")) { - $template->param(istranslation => istranslation($page)); + $template->param(istranslation => scalar istranslation($page)); } if ($template->query(name => "istranslatable")) { $template->param(istranslatable => istranslatable($page)); @@ -307,8 +318,10 @@ sub pagetemplate (@) { sub postscan (@) { my %params = @_; - my $page = $params{page}; + return unless $config{po_strictly_refresh_backlinks}; + + my $page = $params{page}; # backlinks involve back-dependencies, so that nicepagetitle effects, # such as translation status displayed in links, are updated use IkiWiki::Render; @@ -442,19 +455,19 @@ sub checkcontent (@) { return undef; } -sub canremove ($$$) { - my ($page, $cgi, $session) = (shift, shift, shift); +sub canremove (@) { + my %params = @_; - if (istranslation($page)) { + if (istranslation($params{page})) { return gettext("Can not remove a translation. Removing the master page, ". "though, removes its translations as well."); } return undef; } -sub canrename ($$@) { - my ($cgi, $session) = (shift, shift); +sub canrename (@) { my %params = @_; + my $session = $params{session}; if (istranslation($params{src})) { my $masterpage = masterpage($params{src}); @@ -535,11 +548,6 @@ sub formbuilder (@) { my @types = grep { $_ ne 'po' } $field->options; $field->options(\@types) if @types; } - else { - # make sure the default value is not po; - # does this case actually happen? - debug "po(formbuilder) ".gettext("type field is not selected - not implemented yet"); - } } } }