diff --git a/Makefile b/Makefile index 1d944a6..589b26b 100644 --- a/Makefile +++ b/Makefile @@ -56,9 +56,13 @@ validate-html: htmlproofer: htmlproofer $(OUTPUT_DIR) --disable-external --report-invalid-tags --report-missing-names --report-missing-doctype --report-eof-tags --report-mismatched-tags --check-html --check-opengraph --check-favicon --empty-alt-ignore --file-ignore $(OUTPUT_DIR)/search/index.html --url-ignore '../music.txt' +# basic checks for generated HTML and broken links. Persist the broken +# link cache remotely so we can run this in CI. .PHONY: htmltest htmltest: + rsync $(RSYNCFLAGS) deploy@seirdy.one:/home/deploy/refcache.json linter-configs/htmltest/refcache.json htmltest -c linter-configs/htmltest.yml $(OUTPUT_DIR) + rsync $(RSYNCFLAGS) linter-configs/htmltest/refcache.json deploy@seirdy.one:/home/deploy/refcache.json .PHONY: hint hint: hugo .hintrc-local diff --git a/Makefile.online b/Makefile.online index 738b398..b26c085 100644 --- a/Makefile.online +++ b/Makefile.online @@ -24,6 +24,8 @@ lighthouse: rm -rf $(CHROME_PROFILE) redbot: redbot_cli -a $(URL) +.PHONY: hint-online lighthouse redbot + axe: axe $(URLS) --chrome-options $(CHROME_FLAGS_COMMA) --chromedriver-path=$(CHROMEDRIVER_PATH) --show-errors axe-ff: @@ -32,7 +34,17 @@ equal-access: @echo $(URLS) | tr ' ' '\n' >urls.txt achecker --reportLevels violation,recommendation,potentialrecommendation urls.txt rm urls.txt +.PHONY: axe axe-ff equal-access -all: lighthouse hint-online +.validate-feed-main: + scripts/bin/validate-feed $(HUGO_BASEURL)atom.xml +.validate-feed-posts: + scripts/bin/validate-feed $(HUGO_BASEURL)posts/atom.xml +.validate-feed-notes: + scripts/bin/validate-feed $(HUGO_BASEURL)notes/atom.xml +validate-feeds: .validate-feed-main .validate-feed-posts .validate-feed-notes +.PHONY: validate-feeds .validate-feed-main .validate-feed-posts .validate-feed-notes + +.PHONY: all-extra +all-extra: axe htmltest validate-json equal-access htmlproofer lint-css validate-feeds -.PHONY: hint-online lighthouse redbot all diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index 13fc17a..30d3800 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -60,7 +60,7 @@ {{- if .Params.replyURI -}} {{- partial "reply-context" .Params | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | safeHTML }} {{- end -}} - {{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | safeHTML }} + {{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `` "" | safeHTML }} {{- $type := "article" -}} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index eebc96f..94ea759 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -44,7 +44,7 @@ {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} {{ .Permalink }} - {{- .Content | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | html -}} + {{- .Content | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `` "" | html -}} {{ end }} diff --git a/scripts/bin/check-whole-site b/scripts/bin/check-whole-site index b2247b1..5de613c 100755 --- a/scripts/bin/check-whole-site +++ b/scripts/bin/check-whole-site @@ -5,7 +5,7 @@ set -e -u # the name of this program progname="$(basename "${0}")" -help_text="Usage: +help_text="Usage: $progname [BASEURL] Validate the site's markup, CSS, and accessibility. @@ -20,13 +20,10 @@ accessibility on every page in the sitemap. Options: -h Print this help and exit - -b Base URL of site " # TODO: add the following: -# - check broken internal links -# - check broken webring links -# - validate JSON (web app manifest, webfinger) +# - validate JSON schema (web app manifest, webfinger) usage() { printf '%s' "${help_text}" @@ -40,18 +37,12 @@ bad_option() { exit 1 } -base_url='http://localhost:8089/' - while getopts "hb" flags; do case ${flags} in h) usage exit 0 ;; - b) - base_url="$1" - shift - ;; *) bad_option "${flags}" 'invalid option' exit 1 @@ -59,8 +50,10 @@ while getopts "hb" flags; do esac done +base_url="${1-http://localhost:8089}" + # HTML validation is already parallelized, so run that single-threaded. make -j1 HUGO_FLAGS=-DF HUGO_BASEURL="$base_url" clean hugo xhtmlize validate-html -make -j2 -f Makefile.online htmltest validate-json axe equal-access lint-css htmlproofer URLS="$(curl "$base_url/sitemap.xml" | htmlq loc -t | rg -v '/search/$' | tr '\n' ' ')" +make -j2 -f Makefile.online HUGO_BASEURL="$base_url" all-extra URLS="$(curl -sSL "$base_url/sitemap.xml" | htmlq loc -t | rg -v '/search/$' | tr '\n' ' ')" # vi:ft=sh diff --git a/scripts/bin/validate-feed b/scripts/bin/validate-feed new file mode 100755 index 0000000..5157cc8 --- /dev/null +++ b/scripts/bin/validate-feed @@ -0,0 +1,76 @@ +#!/usr/bin/env dash + +set -u + +# the name of this program +progname="$(basename "${0}")" + +help_text="Usage: ${progname} [options...] URL + +Validate the given feed URL, excluding false-positives + +Options: + -h Print this help and exit +" + +usage() { + printf '%s' "${help_text}" +} + +# when the user passess bad args, send a msg to stderr and exit +# usage: bad_option