]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
Bug fix: use &IkiWiki::pagetitle rather than nonexistent &pagetitle in meta plugin...
[ikiwiki.git] / IkiWiki.pm
index 0b420e824975172b7a72ea6484f81c323cbde14e..c1d9119e840662f449d0cd257c0ca1c14df48653 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
 package IkiWiki;
+
 use warnings;
 use strict;
 use Encode;
@@ -532,13 +533,18 @@ sub displaytime ($;$) { #{{{
        return decode_utf8(POSIX::strftime($format, localtime($time)));
 } #}}}
 
-sub beautify_url ($) { #{{{
+sub beautify_urlpath ($) { #{{{
        my $url=shift;
 
        if ($config{usedirs}) {
                $url =~ s!/index.$config{htmlext}$!/!;
        }
-       $url =~ s!^$!./!; # Browsers don't like empty links...
+
+       # Ensure url is not an empty link, and
+       # if it's relative, make that explicit to avoid colon confusion.
+       if ($url !~ /\//) {
+               $url="./$url";
+       }
 
        return $url;
 } #}}}
@@ -548,7 +554,7 @@ sub urlto ($$) { #{{{
        my $from=shift;
 
        if (! length $to) {
-               return beautify_url(baseurl($from)."index.$config{htmlext}");
+               return beautify_urlpath(baseurl($from)."index.$config{htmlext}");
        }
 
        if (! $destsources{$to}) {
@@ -557,7 +563,7 @@ sub urlto ($$) { #{{{
 
        my $link = abs2rel($to, dirname(htmlpage($from)));
 
-       return beautify_url($link);
+       return beautify_urlpath($link);
 } #}}}
 
 sub htmllink ($$$;@) { #{{{
@@ -604,7 +610,7 @@ sub htmllink ($$$;@) { #{{{
        }
        
        $bestlink=abs2rel($bestlink, dirname(htmlpage($page)));
-       $bestlink=beautify_url($bestlink);
+       $bestlink=beautify_urlpath($bestlink);
        
        if (! $opts{noimageinline} && isinlinableimage($bestlink)) {
                return "<img src=\"$bestlink\" alt=\"$linktext\" />";