commit:     2330779776b8ed53ec91629db2d2d56b65e64eb7
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 28 16:24:51 2019 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu Jan  2 12:43:21 2020 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=23307797

Makefile: add new app-text/tidy-html5 sanity check.

This new PHONY "make tidy" target runs the tidy-html5 program, using a
new .tidyrc file, to ensure that the HTML we have generated is free
from certain problems. In particular, it should complain if bug 626032
ever resurfaces and there are duplicate identifiers in some document.

Closes: https://bugs.gentoo.org/626032
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
[Command line options instead of .tidyrc file. Don't fail on first error.]
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 Makefile | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 17be902..407decf 100644
--- a/Makefile
+++ b/Makefile
@@ -49,7 +49,17 @@ validate: prereq
        @xmllint --noout --dtdvalid devbook.dtd $(XMLS) \
          && echo "xmllint validation successful"
 
+# Run app-text/tidy-html5 on the output to detect mistakes.
+# We have to loop through them because otherwise tidy won't
+# tell you which file contains a mistake.
+tidy: $(HTMLS)
+       @for f in $(HTMLS); do \
+         output=$$(tidy -q -errors --drop-empty-elements no $${f} 2>&1) \
+         || { status=$$?; echo "Failed on $${f}:"; echo "$${output}"; }; \
+       done; \
+       exit $${status}
+
 clean:
        rm -f $(HTMLS) $(IMAGES) _documents.js documents.js
 
-.PHONY: all prereq validate clean
+.PHONY: all prereq validate tidy clean

Reply via email to