1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-07-06 17:46:00 +00:00
Files
bips/scripts/link-format-chk.sh
reflecttypefor 764f75e338 script: check link format in nested mediawiki files (#2199)
* script: check link format in nested mediawiki files

Signed-off-by: reflecttypefor <reflecttypefor@outlook.com>
2026-06-26 12:25:30 -07:00

23 lines
706 B
Bash
Executable File

#!/usr/bin/env bash
#
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Check wrong mediawiki link format
ECODE=0
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 links as [URL text], not as [text](URL):"
fi
ECODE=1
while IFS= read -r line; do
echo "- ${fname#./}:$line"
done <<< "$GRES"
fi
done < <(find . -type f -name '*.mediawiki' | sort)
exit $ECODE