]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
* Make RecentChanges use a table and some CSS, should be much more readable.
[ikiwiki.git] / IkiWiki.pm
index d7c082b1decf3e691048bc8eaea1e863404f58d4..56a27b3b02a4f32db7d678c0edec07d9df9ab242 100644 (file)
@@ -260,6 +260,19 @@ sub styleurl (;$) { #{{{
        return $page."style.css";
 } #}}}
 
+sub abs2rel ($$) {
+       # Work around very innefficient behavior in File::Spec if abs2rel
+       # is passed two relative paths. It's much faster if paths are
+       # absolute!
+       my $path="/".shift;
+       my $base="/".shift;
+
+       require File::Spec;
+       my $ret=File::Spec->abs2rel($path, $base);
+       $ret=~s/^// if defined $ret;
+       return $ret;
+}
+
 sub htmllink ($$$;$$$) { #{{{
        my $lpage=shift; # the page doing the linking
        my $page=shift; # the page that will contain the link (different for inline)
@@ -292,8 +305,7 @@ sub htmllink ($$$;$$$) { #{{{
                        "\">?</a>$linktext</span>"
        }
        
-       require File::Spec;
-       $bestlink=File::Spec->abs2rel($bestlink, dirname($page));
+       $bestlink=abs2rel($bestlink, dirname($page));
        
        if (! $noimageinline && isinlinableimage($bestlink)) {
                return "<img src=\"$bestlink\" alt=\"$linktext\" />";