docs/dup-abbr-check.sh
Ron Stone 430d6fa0fe Add duplicate abbr check (r8, r7, r6, r5)
Add a check for duplicate :abbr: anchor strings to prebuild phase
and error on duplicates.

Change-Id: I034c321a3c83aa4c0cbcf551fd90161e9e221c18
Signed-off-by: Ron Stone <ronald.stone@windriver.com>
2023-11-30 14:03:40 +00:00

24 lines
720 B
Bash
Executable File

#!/usr/bin/env bash
# Read a file (typlically source/shared/abbrevs.txt) and report on duplicate
# entries
. $(pwd)/_utils.sh
if [[ -z ${utils_loaded+x} ]]; then echo "Could not load utilities"; exit 1; fi
declare ABBREVS="doc/source/shared/abbrevs.txt"
# declare ABBREVS=".stx-docs/doc/source/shared/abbrevs.txt" # for testing
message "Checking for duplicate acronyms ..."
# acro_keys: array of anchor strings
# acro_keyvals: hash of anchors/definitions
get_abbrs "${ABBREVS}"
# Check for duplicate anchors in :abbr: defs. We've had problems with these
# in the past.
dup_count=$(check_abbr_dups "${acro_keys[@]}")
[[ $dup_count -gt 0 ]] && error "Duplicate(s) MUST be fixed in $ABBREVS"
confirmation "... Done"