test-documentation: Validate HTML with vnu.jar.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-04-22 15:46:04 -07:00 committed by Tim Abbott
parent 12e6189970
commit f407a12ba2
5 changed files with 45 additions and 21 deletions

View File

@ -69,6 +69,7 @@
"stylelint": "10.0.1",
"svgo": "1.2.2",
"swagger-parser": "6.0.5",
"vnu-jar": "^19.6.7",
"webpack-dev-server": "3.5.1"
},
"scripts": {

View File

@ -0,0 +1,10 @@
# Real errors that should be fixed.
Bad value “” for attribute “id” on element “div”: Bad id: An ID must not be the empty string\.
Duplicate ID “[^”]*”\.
The first occurrence of ID “[^”]*” was here\.
# Warnings that are probably less important.
The “type” attribute is unnecessary for JavaScript resources\.
Section lacks heading\. Consider using “h2”-“h6” elements to add identifying headings to all sections\.

View File

@ -41,27 +41,35 @@ rm -rf _build
# The crawler would take a very long time to finish and TravisCI would fail as a result.
sphinx-build -j8 -b html -d _build/doctrees -D html_theme_options.collapse_navigation=True . _build/html
err=0
check() {
if "$@"; then
color_message 92 "Passed!"
else
color_message 91 "Failed!"
err=1
fi
}
color_message 94 "Validating HTML..."
check java -jar ../node_modules/vnu-jar/build/dist/vnu.jar \
--filterfile ../tools/documentation.vnufilter \
--skip-non-html \
_build/html
if [ -n "$skip_check_links" ]; then
color_message 94 "Skipped testing links in documentation."
exit 0
else
cd ../tools/documentation_crawler
if [ -n "$skip_external_links" ]; then
color_message 94 "Testing only internal links in documentation..."
check scrapy crawl_with_status documentation_crawler -a skip_external=set "${loglevel[@]}"
# calling crawl directly as parameter needs to be passed
else
color_message 94 "Testing links in documentation..."
check scrapy crawl_with_status documentation_crawler "${loglevel[@]}"
fi
fi
cd ../tools/documentation_crawler
set +e
if [ -n "$skip_external_links" ]; then
color_message 94 "Testing only internal links in documentation..."
scrapy crawl_with_status documentation_crawler -a skip_external=set "${loglevel[@]}"
# calling crawl directly as parameter needs to be passed
else
color_message 94 "Testing links in documentation..."
scrapy crawl_with_status documentation_crawler "${loglevel[@]}"
fi
result=$?
if [ "$result" -ne 0 ]; then
color_message 91 "Failed!"
exit 1
else
color_message 92 "Passed!"
exit 0
fi
exit "$err"

View File

@ -21,4 +21,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea
# Typically, adding a dependency only requires a minor version bump, and
# removing a dependency requires a major version bump.
PROVISION_VERSION = '35.0'
PROVISION_VERSION = '35.1'

View File

@ -11220,6 +11220,11 @@ vm-browserify@0.0.4:
dependencies:
indexof "0.0.1"
vnu-jar@^19.6.7:
version "19.6.7"
resolved "https://registry.yarnpkg.com/vnu-jar/-/vnu-jar-19.6.7.tgz#b93bf99c11b64b2405d298dae3f511debece7db9"
integrity sha512-uBI4pvolFIbhVQuYempGKsV86kNV5bCH1wVsHPbPCuEtAMk4IovdksO2bdPERUiPRGWgHmJ9A9O/N8FydP4JOg==
void-elements@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"