diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-09-27 13:00:48 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-09-27 13:00:48 -0400 |
commit | 7351d545d96df3c1359312b1a5b79530fa6ab4fd (patch) | |
tree | 07bf7a96a7791a8bdef951aa6e7c0ddfb3489c2a | |
parent | 7e513f22a6c78fbb25dabf3526ad987b76b91d86 (diff) | |
parent | 7f8259441058b16db1fd8dc2c6a53827a46794d8 (diff) | |
download | ikiwiki-7351d545d96df3c1359312b1a5b79530fa6ab4fd.tar ikiwiki-7351d545d96df3c1359312b1a5b79530fa6ab4fd.tar.gz |
Merge commit 'smcv/beautify'
Conflicts:
IkiWiki/Plugin/recentchanges.pm
Note that smcv's approach of using urlto also gets the url right when
redirecting to a non-html file, which is a better approach than my recent
fix to recentchanges
-rw-r--r-- | IkiWiki/Plugin/editpage.pm | 12 | ||||
-rw-r--r-- | IkiWiki/Plugin/poll.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/recentchanges.pm | 7 | ||||
-rw-r--r-- | IkiWiki/Plugin/remove.pm | 2 |
4 files changed, 10 insertions, 15 deletions
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 68f43bf16..687ebf51e 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -95,8 +95,8 @@ sub cgi_editpage ($$) { #{{{ error("bad page name"); } - my $baseurl=$config{url}."/".htmlpage($page); - + my $baseurl = urlto($page, undef, 1); + my $from; if (defined $form->field('from')) { ($from)=$form->field('from')=~/$config{wiki_file_regexp}/; @@ -153,13 +153,13 @@ sub cgi_editpage ($$) { #{{{ if ($form->submitted eq "Cancel") { if ($form->field("do") eq "create" && defined $from) { - redirect($q, "$config{url}/".htmlpage($from)); + redirect($q, urlto($from, undef, 1)); } elsif ($form->field("do") eq "create") { redirect($q, $config{url}); } else { - redirect($q, "$config{url}/".htmlpage($page)); + redirect($q, urlto($page, undef, 1)); } exit; } @@ -250,7 +250,7 @@ sub cgi_editpage ($$) { #{{{ @page_locs=$page; } else { - redirect($q, "$config{url}/".htmlpage($page)); + redirect($q, urlto($page, undef, 1)); exit; } } @@ -418,7 +418,7 @@ sub cgi_editpage ($$) { #{{{ else { # The trailing question mark tries to avoid broken # caches and get the most recent version of the page. - redirect($q, "$config{url}/".htmlpage($page)."?updated"); + redirect($q, urlto($page, undef, 1)."?updated"); } } diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm index 35717c85f..84b02682e 100644 --- a/IkiWiki/Plugin/poll.pm +++ b/IkiWiki/Plugin/poll.pm @@ -102,7 +102,7 @@ sub sessioncgi ($$) { #{{{ my $oldchoice=$session->param($choice_param); if (defined $oldchoice && $oldchoice eq $choice) { # Same vote; no-op. - IkiWiki::redirect($cgi, "$config{url}/".htmlpage($page)); + IkiWiki::redirect($cgi, urlto($page, undef, 1); exit; } @@ -149,7 +149,7 @@ sub sessioncgi ($$) { #{{{ error($@) if $@; my $cookie = CGI::Cookie->new(-name=> $session->name, -value=> $session->id); print $cgi->redirect(-cookie => $cookie, - -url => "$config{url}/".htmlpage($page)); + -url => urlto($page, undef, 1)); exit; } } #}}} diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 563ab7db1..bef0e7085 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -104,12 +104,7 @@ sub cgi ($) { #{{{ "</p>"); } else { - if (defined pagetype($link)) { - IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".htmlpage($link))); - } - else { - IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".$link)); - } + IkiWiki::redirect($cgi, urlto($link, undef, 1)); } exit; diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 869d32f93..772be07b5 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -210,7 +210,7 @@ sub sessioncgi ($$) { #{{{ if (! exists $pagesources{$parent}) { $parent="index"; } - IkiWiki::redirect($q, $config{url}."/".htmlpage($parent)); + IkiWiki::redirect($q, urlto($parent, '/', 1)); } } else { |