Pass build path as arg (r5,r6,dsR6)

This script is being used in repos where the html output
path differs. Pass as arg in tox.ini.

Signed-off-by: Ron Stone <ronald.stone@windriver.com>
Change-Id: I6d2643e9a810e1054feaefb2f46612c4e8f8789a
This commit is contained in:
Ron Stone 2022-04-28 12:11:49 -04:00
parent 171377433c
commit 01d80549f4
2 changed files with 12 additions and 8 deletions

View File

@ -2,10 +2,14 @@
#
# Post-build checks on HTML go here.
if [ -z ${1+x} ]; then echo "Usage: ./htmlChecks.sh <htmlPath>" && exit 0; fi
htmlPath=$1
RED='\033[0;31m'
NC='\033[0m' # No Color
cd doc/build/html
cd ${htmlPath} || { echo "Can't change to ${htmlPath}" && exit 0; }
echo "Checking for \"grey bar\" formatting errors in output ..."
GREY_FILES=( $(grep -rl --include="*.html" "blockquote" .) )
@ -20,7 +24,7 @@ if [ ${#GREY_FILES[@]} != 0 ]; then
fi
echo "Checking for \".. include::\" errors in output ..."
INCLUDE_FILES=( $(grep -rl --include="*.html" --exclude="doc_contribute_guide.html" -e "start-after" -e "end-before" .) )
INCLUDE_FILES=( $(grep -rl --include="*.html" -e "start-after" -e "end-before" .) )
if [ ${#INCLUDE_FILES[@]} != 0 ]; then
echo "Found ${#INCLUDE_FILES[@]} HTML file(s) with exposed \"start-after\" and \"end-before\" _include argument(s):"
for FILE in ${INCLUDE_FILES[@]};
@ -32,16 +36,16 @@ if [ ${#INCLUDE_FILES[@]} != 0 ]; then
fi
echo "Checking for unexpanded substitution errors in output ..."
INCLUDE_FILES=( $(grep -rlo --include="*.html" --exclude="doc_contribute_guide.html" '[>\s]|\S\+|[<\s]' .) )
if [ ${#INCLUDE_FILES[@]} != 0 ]; then
echo -e "Found ${#INCLUDE_FILES[@]} HTML file(s) that may have unexpanded substitution(s):\n${RED}"
SUBS_FILES=( $(grep -rlo --include="*.html" --exclude="doc_contribute_guide.html" '[>\s]|\S\+|[<\s]' .) )
if [ ${#SUBS_FILES[@]} != 0 ]; then
echo -e "Found ${#SUBS_FILES[@]} HTML file(s) that may have unexpanded substitution(s):\n${RED}"
grep -ro --include="*.html" --exclude="doc_contribute_guide.html" '[>\s]|\S\+|[<\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."
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 with in rST markup such as **, \`\`, and so on."
error=1
fi
# Set -W to halt tox
if [[ $1 == "-W" ]] && [[ ${error} -eq 1 ]]; then
if [[ $2 == "-W" ]] && [[ ${error} -eq 1 ]]; then
exit 1
elif [[ ${error} -ne 1 ]]; then
echo "... OK"

View File

@ -17,7 +17,7 @@ deps =
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W --keep-going -d doc/build/doctrees -t starlingx -t openstack -b html doc/source doc/build/html {posargs}
bash htmlChecks.sh
bash htmlChecks.sh doc/build/html
whitelist_externals = bash
htmlChecks.sh