From 9470667a0dcb27a6dcdf51657b85c939ff708af3 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 3 Jun 2009 12:09:29 -0400 Subject: new bug and patch --- ...anted_discussion_links_on_discussion_pages.mdwn | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn (limited to 'doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn') diff --git a/doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn b/doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn new file mode 100644 index 000000000..c7506c6de --- /dev/null +++ b/doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn @@ -0,0 +1,34 @@ +Background: some po translations (amongst which `fr.po`) translate "discussion" to an upper-cased word (in French: "Discussion"). +By the way, this is wished e.g. in German, where such a noun has to be written with an upper-cased "D", but I can not see +the logic behind the added "D" in French. + +Anyway, this gettext-translated word is used to name the discussion pages, as `$discussionlink` in `Render.pm` is +built from `gettext("discussion")`. In the same piece of code, a case-sensitive regexp that tests wether the page +being rendered is a discussion page is case-sensitive. + +On the other hand, new discussion pages are created with a name built from `gettext("Discussion")` (please note the upper-cased +"D"). Such a new page name seems to be automagically downcased. + +This leads to newly created discussion pages not being recognized as discussion pages by the +`$page !~ /.*\/\Q$discussionlink\E$/` regexp, so that then end with an unwanted discussion link. + +A simple fix that seems to work is to make this regexp case-insensitive: + + git diff IkiWiki/Render.pm + diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm + index adae9f0..093c25b 100644 + --- a/IkiWiki/Render.pm + +++ b/IkiWiki/Render.pm + @@ -77,7 +77,7 @@ sub genpage ($$) { + } + if ($config{discussion}) { + my $discussionlink=gettext("discussion"); + - if ($page !~ /.*\/\Q$discussionlink\E$/ && + + if ($page !~ /.*\/\Q$discussionlink\E$/i && + (length $config{cgiurl} || + exists $links{$page."/".$discussionlink})) { + $template->param(discussionlink => htmllink($page, $page, gettext("Discussion"), noimageinline => 1, forcesubpage => 1)); + +But the best way would be to avoid assuming implicitely that translators will translate "discussion" and "Discussion" the same way. + +[[!tag patch]] -- cgit v1.2.3