From: Joey Hess Date: Mon, 13 Sep 2010 19:12:07 +0000 (-0400) Subject: Make currentlang() usable when po is not enabled, so it can be used in example blog... X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/refs/heads/currentlang Make currentlang() usable when po is not enabled, so it can be used in example blog's PageSpecs. --- diff --git a/IkiWiki.pm b/IkiWiki.pm index 6da281999..87e03468a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -2628,6 +2628,10 @@ sub match_ip ($$;@) { } } +sub match_currentlang ($$;@) { + return 1; # stub +} + package IkiWiki::SortSpec; # This is in the SortSpec namespace so that the $a and $b that sort() uses diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index a79e7d7f0..7626fec7e 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -1305,6 +1305,7 @@ sub match_lang ($$;@) { } } +no warnings 'redefine'; # overriding stub version sub match_currentlang ($$;@) { my $page=shift; shift; @@ -1322,6 +1323,7 @@ sub match_currentlang ($$;@) { return IkiWiki::FailReason->new("file language is $lang, whereas current language is $currentlang"); } } +use warnings 'redefine'; sub match_needstranslation ($$;@) { my $page=shift; diff --git a/debian/changelog b/debian/changelog index 3428aa6d3..8f4f7e1bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ ikiwiki (3.20100832) UNRELEASED; urgency=low information earlier than the delete hook. * actiontabs: Improve tab padding. * blueview: Fix display of links to translated pages in the page header. + * Make currentlang() usable when po is not enabled, so it can be used + in example blog's PageSpecs. -- Joey Hess Tue, 07 Sep 2010 12:08:05 -0400 diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn index 6aec561ae..0c4b1893b 100644 --- a/doc/ikiwiki/pagespec.mdwn +++ b/doc/ikiwiki/pagespec.mdwn @@ -55,6 +55,8 @@ Some more elaborate limits can be added to what matches using these functions: * "`comment_pending(glob)`" - matches unmoderated, pending comments. * "`postcomment(glob)`" - matches only when comments are being posted to a page matching the specified glob +* "`currentlang()`" - always matches, unless [[translation|po]] is + enabled For example, to match all pages in a blog that link to the page about music and were written in 2005: