From 764f75e33886fb05cb21fb3ebc230e7f8cb8e526 Mon Sep 17 00:00:00 2001 From: reflecttypefor Date: Sat, 27 Jun 2026 03:25:30 +0800 Subject: [PATCH] script: check link format in nested mediawiki files (#2199) * script: check link format in nested mediawiki files Signed-off-by: reflecttypefor --- scripts/link-format-chk.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/link-format-chk.sh b/scripts/link-format-chk.sh index b0d14849..0c91f466 100755 --- a/scripts/link-format-chk.sh +++ b/scripts/link-format-chk.sh @@ -7,14 +7,16 @@ # Check wrong mediawiki link format ECODE=0 -for fname in *.mediawiki; do - GRES=$(grep -n '](http' "$fname") +while IFS= read -r fname; do + GRES=$(grep -nE '\]\((https?://|\.\./bip-|/bip-)' "$fname") if [ "$GRES" != "" ]; then if [ $ECODE -eq 0 ]; then - >&2 echo "Github Mediawiki format writes link as [URL text], not as [text](url):" + >&2 echo "Github Mediawiki format writes links as [URL text], not as [text](URL):" fi ECODE=1 - echo "- $fname:$GRES" + while IFS= read -r line; do + echo "- ${fname#./}:$line" + done <<< "$GRES" fi -done +done < <(find . -type f -name '*.mediawiki' | sort) exit $ECODE