From e42c3000981b928aa1d1bab23855fe2f0bfc5db4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 23 Jul 2024 18:19:16 +0300 Subject: (single) Fixed inline links/images incorrectly adding title when URL ends with a quoted expression --- single.awk | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'single.awk') diff --git a/single.awk b/single.awk index 708158f..ac2eb7a 100644 --- a/single.awk +++ b/single.awk @@ -259,15 +259,15 @@ blankline { match(substr($0, astart), /\]\([^)]*\)/) aend += RLENGTH - 2 ## aend = indexof(")") href = substr($0, astart + RSTART + 1, RLENGTH - 3) ## ...[...](xxxxx)... - sub(/[ \t]+/, "", href) - if (match(href, /"[^"]*"[ \t]*$/)) { - title = substr(href, RSTART, RLENGTH) + if (match(href, /[ \t]"[^"]*"[ \t]*$/)) { + title = substr(href, RSTART + 1, RLENGTH - 1) href = substr(href, 1, RSTART - 1) } else { title = "\"\"" } + sub(/[ \t]+/, "", href) if (isimg) elem = "\""" else elem = "" inner_anchor "" @@ -296,7 +296,6 @@ function surround(brace, opening, closing) { surround("`" , "" , "") } - !prev_blankline && /^: / { sub(/^

/, "", prev) sub(/^: /, "") -- cgit v1.3.1-23-gd82d