]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
link: Fix renaming wikilinks that contain embedded urls.
authorJoey Hess <joey@kitenet.net>
Wed, 18 Apr 2012 19:15:11 +0000 (15:15 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 18 Apr 2012 19:15:11 +0000 (15:15 -0400)
IkiWiki/Plugin/link.pm
debian/changelog
doc/bugs/renaming_a_page_destroyed_some_links.mdwn

index ef01f110702228fb71356d7d76437161f134b156..1ba28eafd6d4912f16d8aa7fa5c16e01ca9f8dea 100644 (file)
@@ -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;
 
index b994fb55e599fba46f882f608e26b31d778f5d9d..0aca37032a0a7ac0758c127c84ba8d03de10367e 100644 (file)
@@ -21,6 +21,7 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low
     pagenames, not relative wikilink type names. This is necessary to fix
     a bug, and makes pagenames more consistent with the pagespec used
     in the pages parameter. (smcv)
+  * link: Fix renaming wikilinks that contain embedded urls.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 21 Mar 2012 14:33:14 -0400
 
index c1c6b5540aaad1e618fb8d04ff8feddc6ca02b9c..0fb717b02c73d5ae72ae29473c45f42b44d3cced 100644 (file)
@@ -4,3 +4,7 @@ When renaming a page here, ikiwiki destroyed unrelated links from unrelated page
 The renamed page was `configuration/bat-hosts` to `configuration/batman/bat-hosts` and the deleted links were ``\[[AUR | https://aur.archlinux.org/]]` and `\[[CHANGELOG|http://svn.dd-wrt.com:8000/browser/src/router/batman-adv/CHANGELOG]]`. --[[anarcat]]
 
 > <del>Nevermind that, that commit was unrelated to the rename and probably an operator error.</del> - No, actually, I just reproduced this again - see [another example](http://mesh.openisp.ca/recentchanges/#diff-d67dc2f0fdc149b13122fd6cba887a01c693e949).
+
+>> Looks like these all involve the wacky wikilink form that includes an
+>> external url in the link. Fixed rename code to know about those.
+>> [[done]] --[[Joey]]