From: Paul Hänsch Date: Thu, 18 May 2023 11:39:09 +0000 (+0200) Subject: bugfix: enable image links X-Git-Url: http://git.plutz.net/?p=cgilite;a=commitdiff_plain;h=a8a5ea58ca40e57165c37d62b61fdf1c60832c7d bugfix: enable image links --- diff --git a/markdown.awk b/markdown.awk index 63bb044..4f18b9b 100755 --- a/markdown.awk +++ b/markdown.awk @@ -154,11 +154,15 @@ function inline( line, LOCAL, len, code, href, guard ) { return "" href "" inline( substr( line, len + 1) ); # inline links - } else if ( match(line, /^\[([^]]+)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/) ) { + # ,_______________________Image____________________________, + } else if ( match(line, /^\[([^]]+|!\[[^]]+\]\([^"\)]+([ \t]+"[^"]+")?\)(\{[a-zA-Z \t-]*\})?)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/) ) { len = RLENGTH; - text = gensub(/^\[([^]]+)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/, "\\1", 1, substr(line, 1, len) ); - href = gensub(/^\[([^]]+)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/, "\\2", 1, substr(line, 1, len) ); - title = gensub(/^\[([^]]+)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/, "\\4", 1, substr(line, 1, len) ); + text = gensub(/^\[([^]]+|!\[[^]]+\]\([^"\)]+([ \t]+"[^"]+")?\)(\{[a-zA-Z \t-]*\})?)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/, \ + "\\1", 1, substr(line, 1, len) ); + href = gensub(/^\[([^]]+|!\[[^]]+\]\([^"\)]+([ \t]+"[^"]+")?\)(\{[a-zA-Z \t-]*\})?)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/, \ + "\\4", 1, substr(line, 1, len) ); + title = gensub(/^\[([^]]+|!\[[^]]+\]\([^"\)]+([ \t]+"[^"]+")?\)(\{[a-zA-Z \t-]*\})?)\]\(([^"\)]+)([[:space:]]+"([^"]+)")?\)/, \ + "\\6", 1, substr(line, 1, len) ); if ( title ) { return "" inline( text ) "" inline( substr( line, len + 1) ); } else {