From 75e96e3efff646526589c4b6620d56b08b8e6448 Mon Sep 17 00:00:00 2001 From: Ron Stone Date: Tue, 2 Feb 2021 07:55:36 -0500 Subject: [PATCH] HTML checks Restarting review https://review.opendev.org/c/starlingx/docs/+/773155 Adding htmlChecks.sh to tox.ini. Script will run post-build checks for HTML formatting issues not reported by sphinx. Per 773155 review of tox failure, updated tox.ini to pass script to bash. Script was executable in previous review but failed remote runs. Signed-off-by: Ron Stone Change-Id: I603c724fcac567006e20244cffa15ee2860a7b68 --- htmlChecks.sh | 26 ++++++++++++++++++++++++++ tox.ini | 3 +++ 2 files changed, 29 insertions(+) create mode 100755 htmlChecks.sh diff --git a/htmlChecks.sh b/htmlChecks.sh new file mode 100755 index 000000000..934642a7f --- /dev/null +++ b/htmlChecks.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Post-build checks on HTML go here. + +RED='\033[0;31m' +NC='\033[0m' # No Color + +cd doc/build + +# 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 + echo "Found ${#GREY_FILES[@]} file(s):" + for FILE in ${GREY_FILES[@]}; + do + echo -e "${RED}$FILE${NC}" + done + echo "Using a browser, locate vertical grey bars in the left margin of the above file(s), then correct the issue(s) in the cooresponding rST file(s)." + # Set -W to halt tox + if [[ $1 == "-W" ]]; then + exit 1 + fi +fi + +# 2. do - check for emdash before option (missing backticks) \ No newline at end of file diff --git a/tox.ini b/tox.ini index 8bf55d928..badcc37d1 100644 --- a/tox.ini +++ b/tox.ini @@ -17,6 +17,9 @@ deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W --keep-going -d doc/build/doctrees -b html doc/source doc/build/html {posargs} + bash htmlChecks.sh +whitelist_externals = bash + htmlChecks.sh [testenv:api-ref] deps = {[testenv:docs]deps}