From: Paul Hänsch Date: Tue, 30 May 2023 15:11:42 +0000 (+0200) Subject: wiki style links: portability regex fix X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=d45e2c8bfc3c107cffc6771eae97988e11b2ceb5;p=cgilite wiki style links: portability regex fix --- diff --git a/markdown.awk b/markdown.awk index 100242c..33c12bd 100755 --- a/markdown.awk +++ b/markdown.awk @@ -137,10 +137,10 @@ function inline( line, LOCAL, len, code, href, guard ) { } # Wiki style links - } else if ( match( line, /^\[\[([^\]\|]+)(\|([^\]]+))?\]\]/) ) { + } else if ( match( line, /^\[\[([^]|]+)(\|[^]]+)?\]\]/) ) { len = RLENGTH; - href = gensub(/^\[\[([^\]\|]+)(\|([^\]]+))?\]\]/, "\\1", 1, substr(line, 1, len) ); - text = gensub(/^\[\[([^\]\|]+)(\|([^\]]+))?\]\]/, "\\3", 1, substr(line, 1, len) ); + href = gensub(/^\[\[([^]|]+)(\|([^]]+))?\]\]/, "\\1", 1, substr(line, 1, len) ); + text = gensub(/^\[\[([^]|]+)(\|([^]]+))?\]\]/, "\\3", 1, substr(line, 1, len) ); if ( ! text ) text = href; return "" HTML(text) "" inline( substr( line, len + 1) );