Use local paths for most references to pages
authorSimon McVittie <smcv@debian.org>
Tue, 23 Nov 2010 00:19:10 +0000 (00:19 +0000)
committerSimon McVittie <smcv@debian.org>
Tue, 23 Nov 2010 00:19:10 +0000 (00:19 +0000)
IkiWiki/Plugin/comments.pm
IkiWiki/Plugin/editpage.pm
IkiWiki/Plugin/img.pm
IkiWiki/Plugin/parentlinks.pm
IkiWiki/Plugin/recentchanges.pm

index 00945b7535ed12cf74f62898a6174e60a19009c9..f11a817367e1860f490c094f6476fac59aa39769 100644 (file)
@@ -237,7 +237,7 @@ sub preprocess {
        }
 
        if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) {
        }
 
        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});
        }
 
                        "#".page_to_id($params{page});
        }
 
@@ -372,7 +372,7 @@ sub editcomment ($$) {
                error(gettext("bad page name"));
        }
 
                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)));
 
        $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 =>
        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 =>
                }
 
                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')) {
                }
 
                if ($template->query(name => 'commentslink')) {
index 837bfed13983ea23da1ed8792db435fb7a02c0c1..b3ae1fded1d5792513ded7c8ce745bc4e6362fc2 100644 (file)
@@ -98,7 +98,7 @@ sub cgi_editpage ($$) {
                error(gettext("bad page name"));
        }
 
                error(gettext("bad page name"));
        }
 
-       my $baseurl = urlto($page, undef, 1);
+       my $baseurl = urlto($page, undef);
 
        my $from;
        if (defined $form->field('from')) {
 
        my $from;
        if (defined $form->field('from')) {
index bd527c8c82c79eb5a8ef1a2ae6aa694f0279121d..b554a3dfc94a6c6cdd380f8e3461e6b2ec648e6a 100644 (file)
@@ -152,8 +152,8 @@ sub preprocess (@) {
                $imgurl=urlto($imglink, $params{destpage});
        }
        else {
                $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}) {
        }
 
        if (! exists $params{class}) {
index bbd2c5752f58ac4aa94dc932ac4345a5226266a7..203ea13b649e288fe4935d2743469721c15eb1e1 100644 (file)
@@ -27,7 +27,7 @@ sub parentlinks ($) {
        if (! length $page) {
                # dynamic page
                return {
        if (! length $page) {
                # dynamic page
                return {
-                       url => $config{url},
+                       url => IkiWiki::baseurl(undef),
                        page => $config{wikiname},
                };
        }
                        page => $config{wikiname},
                };
        }
index 3542b222862148a090635ef76807d7d8c50e9311..de12bb2c68d0f32ab82f696012f693a4217b8019 100644 (file)
@@ -127,7 +127,7 @@ sub sessioncgi ($$) {
                exit 0;
        }
 
                exit 0;
        }
 
-       IkiWiki::redirect($q, urlto($config{recentchangespage}, ''));
+       IkiWiki::redirect($q, urlto($config{recentchangespage}, undef));
        exit 0;
 }
 
        exit 0;
 }
 
@@ -178,7 +178,7 @@ sub store ($$$) {
                        else {
                                $_->{link} = pagetitle($_->{page});
                        }
                        else {
                                $_->{link} = pagetitle($_->{page});
                        }
-                       $_->{baseurl}="$config{url}/" if length $config{url};
+                       $_->{baseurl}=IkiWiki::baseurl(undef) if length $config{url};
 
                        $_;
                } @{$change->{pages}}
 
                        $_;
                } @{$change->{pages}}
@@ -226,7 +226,7 @@ sub store ($$$) {
                wikiname => $config{wikiname},
        );
        
                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 {
                if exists $config{url};
        
        IkiWiki::run_hooks(pagetemplate => sub {