From: Simon McVittie Date: Tue, 23 Nov 2010 00:19:10 +0000 (+0000) Subject: Use local paths for most references to pages X-Git-Tag: 3.20101231~106^2~4 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/1f019ac2aaa2ba3ec06764f9e62679918cae435d Use local paths for most references to pages --- diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 00945b753..f11a81736 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, 1). + $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page}), undef). "#".page_to_id($params{page}); } @@ -372,7 +372,7 @@ sub editcomment ($$) { error(gettext("bad page name")); } - my $baseurl = urlto($page, undef, 1); + my $baseurl = urlto($page, undef); $form->title(sprintf(gettext("commenting on %s"), IkiWiki::pagetitle($page))); @@ -810,14 +810,14 @@ sub pagetemplate (@) { if ($shown) { if ($template->query(name => 'commentsurl')) { $template->param(commentsurl => - urlto($page, undef, 1).'#comments'); + urlto($page, undef).'#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, 1).'comments.atom'); + urlto($page, undef).'comments.atom'); } if ($template->query(name => 'commentslink')) { diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 837bfed13..b3ae1fded 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, 1); + my $baseurl = urlto($page, undef); my $from; if (defined $form->field('from')) { diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index bd527c8c8..b554a3dfc 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -152,8 +152,8 @@ sub preprocess (@) { $imgurl=urlto($imglink, $params{destpage}); } else { - $fileurl="$config{url}/$file"; - $imgurl="$config{url}/$imglink"; + $fileurl=urlto($file, undef); + $imgurl=urlto($imglink, undef); } if (! exists $params{class}) { diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm index bbd2c5752..203ea13b6 100644 --- a/IkiWiki/Plugin/parentlinks.pm +++ b/IkiWiki/Plugin/parentlinks.pm @@ -27,7 +27,7 @@ sub parentlinks ($) { if (! length $page) { # dynamic page return { - url => $config{url}, + url => IkiWiki::baseurl(undef), page => $config{wikiname}, }; } diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 3542b2228..de12bb2c6 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}, '')); + IkiWiki::redirect($q, urlto($config{recentchangespage}, undef)); exit 0; } @@ -178,7 +178,7 @@ sub store ($$$) { else { $_->{link} = pagetitle($_->{page}); } - $_->{baseurl}="$config{url}/" if length $config{url}; + $_->{baseurl}=IkiWiki::baseurl(undef) if length $config{url}; $_; } @{$change->{pages}} @@ -226,7 +226,7 @@ sub store ($$$) { wikiname => $config{wikiname}, ); - $template->param(permalink => "$config{url}/$config{recentchangespage}/#change-".titlepage($change->{rev})) + $template->param(permalink => urlto($config{recentchangespage}, undef)."#change-".titlepage($change->{rev})) if exists $config{url}; IkiWiki::run_hooks(pagetemplate => sub {