diff --git a/package.json b/package.json index 908515f642..9a9daf5cda 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/tools/documentation.vnufilter b/tools/documentation.vnufilter new file mode 100644 index 0000000000..35ea67a778 --- /dev/null +++ b/tools/documentation.vnufilter @@ -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\. diff --git a/tools/test-documentation b/tools/test-documentation index 7d03ae210c..6cc8623c27 100755 --- a/tools/test-documentation +++ b/tools/test-documentation @@ -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" diff --git a/version.py b/version.py index eaaaa9784f..1fabb20521 100644 --- a/version.py +++ b/version.py @@ -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' diff --git a/yarn.lock b/yarn.lock index 86b1795ad2..91cf98ea07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"