From 07583c8283f9d17523808a3b2a584007a930e200 Mon Sep 17 00:00:00 2001 From: csh Date: Thu, 8 Jan 2026 15:44:39 +0800 Subject: [PATCH] :bug: fix(tests): make doc link check awk-portable --- tests/integration/check_doc_links.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/integration/check_doc_links.sh b/tests/integration/check_doc_links.sh index 1803222..d16c605 100644 --- a/tests/integration/check_doc_links.sh +++ b/tests/integration/check_doc_links.sh @@ -100,13 +100,19 @@ extract_links() { gsub(/`[^`]*`/, "", line) - while (match(line, /\[[^]]+\]\(([^)]+)\)/, m)) { - print NR "\t" m[1] + while (match(line, /\[[^]]+\]\([^)]*\)/)) { + link = substr(line, RSTART, RLENGTH) + sub(/^\[[^]]+\]\(/, "", link) + sub(/\)$/, "", link) + print NR "\t" link line = substr(line, RSTART + RLENGTH) } - if (match(line, /^\[[^]]+\]:[[:space:]]*(.+)/, ref)) { - print NR "\t" ref[1] + if (match(line, /^\[[^]]+\]:[[:space:]]*[^[:space:]]+/)) { + link = substr(line, RSTART, RLENGTH) + sub(/^\[[^]]+\]:[[:space:]]*/, "", link) + sub(/[[:space:]].*$/, "", link) + print NR "\t" link } } ' "$1"