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.

master
Joey Hess 2011-06-29 16:38:32 -04:00
parent 9bae303ec4
commit 25b01f9404
4 changed files with 16 additions and 3 deletions

View File

@ -1237,7 +1237,7 @@ sub htmllink ($$$;@) {
$cgilink = "<a href=\"". $cgilink = "<a href=\"".
cgiurl( cgiurl(
do => "create", do => "create",
page => lc($link), page => $link,
from => $lpage from => $lpage
)."\" rel=\"nofollow\">?</a>"; )."\" rel=\"nofollow\">?</a>";
} }

View File

@ -227,6 +227,8 @@ sub cgi_editpage ($$) {
$absolute || $absolute ||
$form->submitted) { $form->submitted) {
@page_locs=$best_loc=$page; @page_locs=$best_loc=$page;
unshift @page_locs, lc($page)
if ! $form->submitted && lc($page) ne $page;
} }
else { else {
my $dir=$from."/"; my $dir=$from."/";
@ -241,13 +243,18 @@ sub cgi_editpage ($$) {
$best_loc=$dir.$page; $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, $dir.$page;
push @page_locs, "$from/$page"; push @page_locs, $from."/".lc($page) if $mixedcase;
push @page_locs, $from."/".$page;
while (length $dir) { while (length $dir) {
$dir=~s![^/]+/+$!!; $dir=~s![^/]+/+$!!;
push @page_locs, $dir.lc($page) if $mixedcase;
push @page_locs, $dir.$page; push @page_locs, $dir.$page;
} }
my $userpage=IkiWiki::userpage($page); my $userpage=IkiWiki::userpage($page);
push @page_locs, $userpage push @page_locs, $userpage
if ! grep { $_ eq $userpage } @page_locs; if ! grep { $_ eq $userpage } @page_locs;

3
debian/changelog vendored
View File

@ -19,6 +19,9 @@ ikiwiki (3.20110609) UNRELEASED; urgency=low
page by simply linking to them, or by using the img directive. page by simply linking to them, or by using the img directive.
Note that sanitizing svg files is still not addressed. Note that sanitizing svg files is still not addressed.
* img: Generate png format thumbnails for svg images. * 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 <joeyh@debian.org> Thu, 09 Jun 2011 10:06:44 -0400 -- Joey Hess <joeyh@debian.org> Thu, 09 Jun 2011 10:06:44 -0400

View File

@ -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 > Then, which one is the default wouldn't much matter. (The non-lower cased
> one would probably be the best choice.) --[[Joey]] > 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]] >> 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]]