From 2e75d5eba206fd739200f3e5b59c1472a152157e Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 21 Jul 2024 16:05:11 +0300 Subject: (single) Fixed anchors causing inifinite loop --- single.awk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'single.awk') diff --git a/single.awk b/single.awk index 5922d35..7e67aa0 100644 --- a/single.awk +++ b/single.awk @@ -177,11 +177,12 @@ blankline { # Links /\[[^\]]*\]\([^)]*\)/ { while (match($0, /\[[^\]]*\]\(/)) { - astart = RSTART + RLENGTH - 1 ## astart = indexof("(") + astart = RSTART ## astart = indexof("[") inner_anchor = substr($0, RSTART + 1, RLENGTH - 3) ## ...[xxxxx](...)... + aend = RSTART + RLENGTH - 1 match(substr($0, astart), /\]\([^)]*)/) - aend += RLENGTH - 2 ## astart = indexof(")") + aend += RLENGTH - 2 ## aend = indexof(")") href = substr($0, astart + RSTART + 1, RLENGTH - 3) ## ...[...](xxxxx)... title = "" -- cgit v1.3.1-23-gd82d