From 679feb8f5ca1ffbeefbebb75575b816e68ffce3a Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sat, 13 Aug 2022 14:05:16 -0700 Subject: [PATCH] exclude BIMI icon and search from Nu validator --- Makefile | 4 +--- linter-configs/vnu_filter.jq | 4 ---- scripts/vnu.sh | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 scripts/vnu.sh diff --git a/Makefile b/Makefile index 0cd3f65..ebf34c7 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,6 @@ RSYNCFLAGS_EXTRA ?= # compression gets slow for extreme levels like the old "70109" ECT_LEVEL=9 -VNU ?= vnu - csv/webrings.csv: sh scripts/populate-webrings.sh @@ -60,7 +58,7 @@ validate-json: .PHONY: validate-html validate-html: - $(VNU) --stdout --format json --skip-non-html --also-check-svg $(OUTPUT_DIR) | sh scripts/filter-vnu.sh + sh scripts/vnu.sh $(OUTPUT_DIR) .PHONY: htmlproofer htmlproofer: diff --git a/linter-configs/vnu_filter.jq b/linter-configs/vnu_filter.jq index 95cc119..1262fbc 100644 --- a/linter-configs/vnu_filter.jq +++ b/linter-configs/vnu_filter.jq @@ -21,10 +21,6 @@ ( # see https://github.com/w3c/css-validator/issues/370 .message == "CSS: “contain”: “inline-size” is not a “contain” value." ) - or - ( # the search page has raw templates, let those slide. I validate the final dynamic search page manually. - .url | test ("/search/index.") - ) ) | not ) ) | del(..|select(. == [])) | del(..|select(. == {})) | select(. != null) diff --git a/scripts/vnu.sh b/scripts/vnu.sh new file mode 100644 index 0000000..1c330db --- /dev/null +++ b/scripts/vnu.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -e -u +pwd="$(dirname "$0")" +output_dir="$1" + +files_to_analyze() { + find "$output_dir" -type f -name '*.html' -o -name '*.svg' \ + | grep -Ev '(bimi\.svg|search/index\.x?html)$' +} + +# we skip the BIMI icon (VNU can't handle SVG 1.2) and the search page (it has raw templates). +vnu \ + --stdout \ + --format json \ + --also-check-svg \ + $(files_to_analyze) \ + | sh "$pwd/filter-vnu.sh"