From 1182e9d0eea5d995b830c2b3ed73c5b5b95dec99 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 29 Nov 2010 15:07:26 -0400 Subject: [PATCH] use one-parameter form of urlto --- IkiWiki/Plugin/comments.pm | 13 ++++++------- IkiWiki/Plugin/editpage.pm | 10 +++++----- IkiWiki/Plugin/goto.pm | 2 +- IkiWiki/Plugin/img.pm | 4 ++-- IkiWiki/Plugin/poll.pm | 4 ++-- IkiWiki/Plugin/recentchanges.pm | 2 +- IkiWiki/Plugin/remove.pm | 2 +- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index a3cb7c3d5..68ac4cfae 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -237,7 +237,7 @@ sub preprocess { } if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) { - $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page}), undef). + $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page})). "#".page_to_id($params{page}); } @@ -372,7 +372,7 @@ sub editcomment ($$) { error(gettext("bad page name")); } - my $baseurl = urlto($page, undef); + my $baseurl = urlto($page); $form->title(sprintf(gettext("commenting on %s"), IkiWiki::pagetitle($page))); @@ -385,8 +385,7 @@ sub editcomment ($$) { if ($form->submitted eq CANCEL) { # bounce back to the page they wanted to comment on, and exit. - # CANCEL need not be considered in future - IkiWiki::redirect($cgi, urlto($page, undef)); + IkiWiki::redirect($cgi, $baseurl); exit; } @@ -552,7 +551,7 @@ sub editcomment ($$) { # Jump to the new comment on the page. # The trailing question mark tries to avoid broken # caches and get the most recent version of the page. - IkiWiki::redirect($cgi, urlto($page, undef). + IkiWiki::redirect($cgi, urlto($page). "?updated#".page_to_id($location)); } @@ -811,14 +810,14 @@ sub pagetemplate (@) { if ($shown) { if ($template->query(name => 'commentsurl')) { $template->param(commentsurl => - urlto($page, undef).'#comments'); + urlto($page).'#comments'); } if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) { # This will 404 until there are some comments, but I # think that's probably OK... $template->param(atomcommentsurl => - urlto($page, undef).'comments.atom'); + urlto($page).'comments.atom'); } if ($template->query(name => 'commentslink')) { diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index b3ae1fded..da071d492 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -98,7 +98,7 @@ sub cgi_editpage ($$) { error(gettext("bad page name")); } - my $baseurl = urlto($page, undef); + my $baseurl = urlto($page); my $from; if (defined $form->field('from')) { @@ -156,13 +156,13 @@ sub cgi_editpage ($$) { my $previewing=0; if ($form->submitted eq "Cancel") { if ($form->field("do") eq "create" && defined $from) { - redirect($q, urlto($from, undef)); + redirect($q, urlto($from)); } elsif ($form->field("do") eq "create") { redirect($q, baseurl(undef)); } else { - redirect($q, urlto($page, undef)); + redirect($q, $baseurl); } exit; } @@ -262,7 +262,7 @@ sub cgi_editpage ($$) { @page_locs=$page; } else { - redirect($q, urlto($page, undef)); + redirect($q, $baseurl); exit; } } @@ -434,7 +434,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, urlto($page, undef)."?updated"); + redirect($q, $baseurl."?updated"); } } diff --git a/IkiWiki/Plugin/goto.pm b/IkiWiki/Plugin/goto.pm index 7f31fa5ca..0eb83fc20 100644 --- a/IkiWiki/Plugin/goto.pm +++ b/IkiWiki/Plugin/goto.pm @@ -64,7 +64,7 @@ sub cgi_goto ($;$) { ) } else { - IkiWiki::redirect($q, urlto($link, undef)); + IkiWiki::redirect($q, urlto($link)); } exit; diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index b554a3dfc..103f6b2b3 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -152,8 +152,8 @@ sub preprocess (@) { $imgurl=urlto($imglink, $params{destpage}); } else { - $fileurl=urlto($file, undef); - $imgurl=urlto($imglink, undef); + $fileurl=urlto($file); + $imgurl=urlto($imglink); } if (! exists $params{class}) { diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm index 27df104ab..2773486a6 100644 --- a/IkiWiki/Plugin/poll.pm +++ b/IkiWiki/Plugin/poll.pm @@ -103,7 +103,7 @@ sub sessioncgi ($$) { my $oldchoice=$session->param($choice_param); if (defined $oldchoice && $oldchoice eq $choice) { # Same vote; no-op. - IkiWiki::redirect($cgi, urlto($page, undef)); + IkiWiki::redirect($cgi, urlto($page)); exit; } @@ -153,7 +153,7 @@ sub sessioncgi ($$) { error($@) if $@; my $cookie = CGI::Cookie->new(-name=> $session->name, -value=> $session->id); print $cgi->redirect(-cookie => $cookie, - -url => urlto($page, undef)); + -url => urlto($page)); exit; } } diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index de12bb2c6..6fccd16f6 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -127,7 +127,7 @@ sub sessioncgi ($$) { exit 0; } - IkiWiki::redirect($q, urlto($config{recentchangespage}, undef)); + IkiWiki::redirect($q, urlto($config{recentchangespage})); exit 0; } diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 336a781ed..bc481502a 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -240,7 +240,7 @@ sub sessioncgi ($$) { if (! exists $pagesources{$parent}) { $parent="index"; } - IkiWiki::redirect($q, urlto($parent, undef)); + IkiWiki::redirect($q, urlto($parent)); } } else { -- 2.39.5