diff options
author | intrigeri <intrigeri@boum.org> | 2009-08-28 15:00:16 +0200 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2009-08-28 15:00:16 +0200 |
commit | e671e72053e81fa06cb9c9407ff17a0beff2f1fe (patch) | |
tree | 7adf8f8551e70e224d3f6e67c4b2882aacca7e08 | |
parent | 53dc18ec2b46ded088a3dca0abafb2f3c184969e (diff) |
po: better rootpage logic for inline's post form
Set rootpage to the non-l10n'd rootpage parameter if it is set,
else to the masterpage of the linking page.
Signed-off-by: intrigeri <intrigeri@boum.org>
-rw-r--r-- | IkiWiki/Plugin/po.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 55c1c32c6..14c7318fe 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -59,6 +59,8 @@ sub import { inject(name => "IkiWiki::urlto", call => \&myurlto); $origsubs{'cgiurl'}=\&IkiWiki::cgiurl; inject(name => "IkiWiki::cgiurl", call => \&mycgiurl); + $origsubs{'rootpage'}=\&IkiWiki::rootpage; + inject(name => "IkiWiki::rootpage", call => \&myrootpage); } @@ -649,6 +651,22 @@ sub mycgiurl (@) { return $origsubs{'cgiurl'}->(%params); } +sub myrootpage (@) { + my %params=@_; + + my $rootpage; + if (exists $params{rootpage}) { + $rootpage=$origsubs{'bestlink'}->($params{page}, $params{rootpage}); + if (!length $rootpage) { + $rootpage=$params{rootpage}; + } + } + else { + $rootpage=masterpage($params{page}); + } + return $rootpage; +} + # ,---- # | Blackboxes for private data # `---- |