]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Skip link parsing if a code block identifier is found
authorPaul <Paul@web>
Sat, 9 Jun 2018 16:24:48 +0000 (12:24 -0400)
committeradmin <admin@branchable.com>
Sat, 9 Jun 2018 16:24:48 +0000 (12:24 -0400)
doc/todo/Don__39__t_change_text_like___91____91__this__93____93___in_code_blocks.mdwn [new file with mode: 0644]

diff --git a/doc/todo/Don__39__t_change_text_like___91____91__this__93____93___in_code_blocks.mdwn b/doc/todo/Don__39__t_change_text_like___91____91__this__93____93___in_code_blocks.mdwn
new file mode 100644 (file)
index 0000000..a022b55
--- /dev/null
@@ -0,0 +1,33 @@
+    diff --git IkiWiki/Plugin/link.pm IkiWiki/Plugin/link.pm
+    index 1ba28eafd..27427b183 100644
+    --- IkiWiki/Plugin/link.pm
+    +++ IkiWiki/Plugin/link.pm
+    @@ -107,7 +107,13 @@ sub linkify (@) {
+        my $page=$params{page};
+        my $destpage=$params{destpage};
+     
+    -   $params{content} =~ s{(\\?)$link_regexp}{
+    +    my $content;
+    +    for my $line ( split /\n/, $params{content} ) {
+    +        if ( $line =~ /^(?:\t|    )/ ) {
+    +            $content .= $line . "\n";
+    +            next;
+    +        }
+    +        $line =~ s{(\\?)$link_regexp}{
+                 defined $2
+                     ? ( $1
+                         ? "[[$2|$3".(defined $4 ? "#$4" : "")."]]"
+    @@ -122,8 +128,10 @@ sub linkify (@) {
+                             : htmllink($page, $destpage, linkpage($3),
+                                 anchor => $4))
+             }eg;
+    +        $content .= $line . "\n";
+    +    }
+     
+    -   return $params{content};
+    +    return $content;
+     }
+     
+     sub scan (@) {
+
+Related to [[bugs/wiki links still processed inside code blocks]] and [[forum/How_to_format___91____91__foobar__93____93___in_code_blocks__63__]].