From b0cfbcabdfcad9803408618a1b999b765ec82eda Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 9 Jun 2018 12:24:48 -0400 Subject: [PATCH 1/1] Skip link parsing if a code block identifier is found --- ...__91__this__93____93___in_code_blocks.mdwn | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 doc/todo/Don__39__t_change_text_like___91____91__this__93____93___in_code_blocks.mdwn 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 index 000000000..a022b5552 --- /dev/null +++ b/doc/todo/Don__39__t_change_text_like___91____91__this__93____93___in_code_blocks.mdwn @@ -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__]]. -- 2.39.2