From 25b01f94045eaa262587fcd18e8525eed9c18157 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 29 Jun 2011 16:38:32 -0400 Subject: [PATCH] Preserve mixed case in page creation links, and when creating a page whose title is mixed case, allow selecting between the mixed case and all lower-case names. --- IkiWiki.pm | 2 +- IkiWiki/Plugin/editpage.pm | 11 +++++++++-- debian/changelog | 3 +++ .../Titles_are_lower-cased_when_creating_a_page.mdwn | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 7035cb034..8a66dcedb 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1237,7 +1237,7 @@ sub htmllink ($$$;@) { $cgilink = " "create", - page => lc($link), + page => $link, from => $lpage )."\" rel=\"nofollow\">?"; } diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 3d094c263..a385ed839 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -227,6 +227,8 @@ sub cgi_editpage ($$) { $absolute || $form->submitted) { @page_locs=$best_loc=$page; + unshift @page_locs, lc($page) + if ! $form->submitted && lc($page) ne $page; } else { my $dir=$from."/"; @@ -241,13 +243,18 @@ sub cgi_editpage ($$) { $best_loc=$dir.$page; } + my $mixedcase=lc($page) ne $page; + + push @page_locs, $dir.lc($page) if $mixedcase; push @page_locs, $dir.$page; - push @page_locs, "$from/$page"; + push @page_locs, $from."/".lc($page) if $mixedcase; + push @page_locs, $from."/".$page; while (length $dir) { $dir=~s![^/]+/+$!!; + push @page_locs, $dir.lc($page) if $mixedcase; push @page_locs, $dir.$page; } - + my $userpage=IkiWiki::userpage($page); push @page_locs, $userpage if ! grep { $_ eq $userpage } @page_locs; diff --git a/debian/changelog b/debian/changelog index 7b8d84e45..ddd0f7a28 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,9 @@ ikiwiki (3.20110609) UNRELEASED; urgency=low page by simply linking to them, or by using the img directive. Note that sanitizing svg files is still not addressed. * img: Generate png format thumbnails for svg images. + * Preserve mixed case in page creation links, and when creating a page + whose title is mixed case, allow selecting between the mixed case and + all lower-case names. -- Joey Hess Thu, 09 Jun 2011 10:06:44 -0400 diff --git a/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn b/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn index 059415819..351c2c1a1 100644 --- a/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn +++ b/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn @@ -32,3 +32,6 @@ If I click on "Czars in Russia", I'd like Ikiwiki to create "Czars\_in\_Russia.m > Then, which one is the default wouldn't much matter. (The non-lower cased > one would probably be the best choice.) --[[Joey]] >> Either of your proposed solutions (make it the default or include both in the pop-up menu) sounds fine to me. Which one is easier? :) --[[sabr]] + +>>> [[Done]]; it now defaults to the mixed case title and provides +>>> the lower-case one as an option in the select box. --[[Joey]] -- 2.26.2