]> git.pld-linux.org Git - packages/dokuwiki-plugin-pagemove.git/blame - dokuwiki-plugin-pagemove-redirectlinks.patch
- update to 20110811
[packages/dokuwiki-plugin-pagemove.git] / dokuwiki-plugin-pagemove-redirectlinks.patch
CommitLineData
876cb737
ER
1--- dokuwiki-plugin-pagemove-20110811/admin.php~ 2012-06-12 23:38:07.000000000 +0300
2+++ dokuwiki-plugin-pagemove-20110811/admin.php 2012-06-12 23:47:42.513225196 +0300
3@@ -742,7 +742,8 @@
4 */
5 function _pm_updatelinks(&$text, $links) {
6 foreach( $links as $old => $new ) {
7- $text = preg_replace( '#\[\[:?' . $old . '((\]\])|[\|\#])#i', '[[' . $new . '\1', $text);
8+ $text = preg_replace( '#\[\[:?' . $old . '(\]\]|[\|\#])#i', '[[' . $new . '\1', $text);
9+ $text = preg_replace( '#~~REDIRECT>' . $old . '(~~|[\|\#])#i', '~~REDIRECT>' . $new . '\1', $text);
10 }
9781783a
ER
11 }
12
876cb737
ER
13@@ -772,7 +772,14 @@
14 // match all links
15 // FIXME may be incorrect because of code blocks
16 // TODO CamelCase isn't supported, too
17- preg_match_all('#\[\[(.+?)\]\]#si', $text, $matches, PREG_SET_ORDER);
18+ $matches = array();
19+ if (preg_match_all('#\[\[(.+?)\]\]#s', $text, $m, PREG_SET_ORDER)) {
20+ $matches = array_merge($matches, $m);
21+ }
22+ if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) {
23+ $matches = array_merge($matches, $m);
24+ }
9781783a 25+
876cb737
ER
26 foreach($matches as $match) {
27 // ignore local headings [[#some_heading]]
28 if ( preg_match('/^#/', $match[1])) continue;
29@@ -819,7 +819,13 @@
30 // match all links
31 // FIXME may be incorrect because of code blocks
32 // TODO CamelCase isn't supported, too
33- preg_match_all('#{{(.[^>]+?)}}#si', $text, $matches, PREG_SET_ORDER);
34+ $matches = array();
35+ if (preg_match_all('#{{(.[^>]+?)}}#si', $text, $m, PREG_SET_ORDER)) {
36+ $matches = array_merge($matches, $m);
37+ }
38+ if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) {
39+ $matches = array_merge($matches, $m);
40+ }
41 foreach($matches as $match) {
42 // get ID from link and discard most non wikilinks
43 list($mid) = split('(\?|\|)', $match[1], 2);
44@@ -947,7 +947,13 @@
45 // match all links
46 // FIXME may be incorrect because of code blocks
47 // FIXME CamelCase isn't supported, too
48- preg_match_all('#\[\[(.+?)\]\]#si', $text, $matches, PREG_SET_ORDER);
49+ $matches = array();
50+ if (preg_match_all('#\[\[(.+?)\]\]#s', $text, $m, PREG_SET_ORDER)) {
51+ $matches = array_merge($matches, $m);
52+ }
53+ if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) {
54+ $matches = array_merge($matches, $m);
55+ }
56 foreach($matches as $match) {
57 // get ID from link and discard most non wikilinks
58 list($matchLink) = split('[\|#]', $match[1], 2);
This page took 0.085405 seconds and 4 git commands to generate.