From da45342b396d5a8c6ead9e2e7733c0aa6a742f3e Mon Sep 17 00:00:00 2001 From: Ron Stone Date: Wed, 7 Jul 2021 07:05:21 -0400 Subject: [PATCH] Substitution check Add scan for unexpanded substitutions to post-build html checks. Signed-off-by: Ron Stone Change-Id: I4e0263f94cede426a993c5204203f602f63020be --- htmlChecks.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htmlChecks.sh b/htmlChecks.sh index 824301d53..4f347595e 100755 --- a/htmlChecks.sh +++ b/htmlChecks.sh @@ -7,7 +7,6 @@ NC='\033[0m' # No Color cd doc/build/html -# 1. Check for rST formatting issues that don't cause build warnings/errors echo "Checking for \"grey bar\" formatting errors in output ..." GREY_FILES=( $(grep -rl --include="*.html" "blockquote" .) ) if [ ${#GREY_FILES[@]} != 0 ]; then @@ -32,6 +31,15 @@ if [ ${#INCLUDE_FILES[@]} != 0 ]; then error=1 fi +echo "Checking for unexpanded substitution errors in output ..." +INCLUDE_FILES=( $(grep -rl --include="*.html" ' |\S*| ' .) ) +if [ ${#INCLUDE_FILES[@]} != 0 ]; then + echo -e "Found ${#INCLUDE_FILES[@]} HTML file(s) that may have unexpanded substitution(s):\n${RED}" + grep -r --include="*.html" ' |\S*| ' . | awk -F: '{if(f!=$1)print ""; f=$1; print $0;}' + echo -e "${NC}\nCorrect the issue(s) in the corresponding rST file(s).\nHINT: Substitions are not allowed in code blocks, :ref:s,\n:doc:s, or within rST markup such as **, \`\`, and so on." + error=1 +fi + # Set -W to halt tox if [[ $1 == "-W" ]] && [[ ${error} -eq 1 ]]; then exit 1