]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/shortcut.pm
correct variable scoping error in nils's patch
[ikiwiki.git] / IkiWiki / Plugin / shortcut.pm
index 7b89bf879cdf48be4421a205399cb27a07a489f8..0e7769c67c7f22f36b9b1e857660cc9b8ba0ad9c 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::shortcut;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "checkconfig", id => "shortcut", call => \&checkconfig);
@@ -54,6 +54,10 @@ sub shortcut_expand ($$@) { #{{{
        my $encoded_text=$text;
        $encoded_text=~s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
        
+       $url=~s{\%([sS])}{
+               $1 eq 's' ? $encoded_text : $text
+       }eg;
+
        $text=~s/_/ /g;
        if (defined $desc) {
                $desc=~s/\%s/$text/g;
@@ -62,7 +66,6 @@ sub shortcut_expand ($$@) { #{{{
                $desc=$text;
        }
 
-       $url=~s/\%s/$encoded_text/g;
        return "<a href=\"$url\">$desc</a>";
 } #}}}