aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-04-18 15:15:11 -0400
committerJoey Hess <joey@kitenet.net>2012-04-18 15:15:11 -0400
commit169550a926f242ad9e15efd3a2c53b73b5841126 (patch)
treef40ba11f4198f913ecae35982e5c15e09ead3352 /IkiWiki
parentda988473e1bd488c6432f9e71c17460057500594 (diff)
downloadikiwiki-169550a926f242ad9e15efd3a2c53b73b5841126.tar
ikiwiki-169550a926f242ad9e15efd3a2c53b73b5841126.tar.gz
link: Fix renaming wikilinks that contain embedded urls.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/link.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm
index ef01f1107..1ba28eafd 100644
--- a/IkiWiki/Plugin/link.pm
+++ b/IkiWiki/Plugin/link.pm
@@ -144,9 +144,9 @@ sub renamepage (@) {
my $old=$params{oldpage};
my $new=$params{newpage};
- $params{content} =~ s{(?<!\\)$link_regexp}{
- if (! is_externallink($page, $2, $3)) {
- my $linktext=$2;
+ $params{content} =~ s{(?<!\\)($link_regexp)}{
+ if (! is_externallink($page, $3, $4)) {
+ my $linktext=$3;
my $link=$linktext;
if (bestlink($page, linkpage($linktext)) eq $old) {
$link=pagetitle($new, 1);
@@ -161,9 +161,12 @@ sub renamepage (@) {
$link="/$link";
}
}
- defined $1
- ? ( "[[$1|$link".($3 ? "#$3" : "")."]]" )
- : ( "[[$link". ($3 ? "#$3" : "")."]]" )
+ defined $2
+ ? ( "[[$2|$link".($4 ? "#$4" : "")."]]" )
+ : ( "[[$link". ($4 ? "#$4" : "")."]]" )
+ }
+ else {
+ $1
}
}eg;