mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02:09 +00:00
Compare commits
2 commits
4b42a8686d
...
866d6b11ee
Author | SHA1 | Date | |
---|---|---|---|
|
866d6b11ee | ||
|
84aaf683b0 |
7 changed files with 113 additions and 16 deletions
4
Makefile
4
Makefile
|
@ -56,9 +56,13 @@ validate-html:
|
||||||
htmlproofer:
|
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'
|
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
|
.PHONY: htmltest
|
||||||
htmltest:
|
htmltest:
|
||||||
|
rsync $(RSYNCFLAGS) deploy@seirdy.one:/home/deploy/refcache.json linter-configs/htmltest/refcache.json
|
||||||
htmltest -c linter-configs/htmltest.yml $(OUTPUT_DIR)
|
htmltest -c linter-configs/htmltest.yml $(OUTPUT_DIR)
|
||||||
|
rsync $(RSYNCFLAGS) linter-configs/htmltest/refcache.json deploy@seirdy.one:/home/deploy/refcache.json
|
||||||
|
|
||||||
.PHONY: hint
|
.PHONY: hint
|
||||||
hint: hugo .hintrc-local
|
hint: hugo .hintrc-local
|
||||||
|
|
|
@ -24,6 +24,8 @@ lighthouse:
|
||||||
rm -rf $(CHROME_PROFILE)
|
rm -rf $(CHROME_PROFILE)
|
||||||
redbot:
|
redbot:
|
||||||
redbot_cli -a $(URL)
|
redbot_cli -a $(URL)
|
||||||
|
.PHONY: hint-online lighthouse redbot
|
||||||
|
|
||||||
axe:
|
axe:
|
||||||
axe $(URLS) --chrome-options $(CHROME_FLAGS_COMMA) --chromedriver-path=$(CHROMEDRIVER_PATH) --show-errors
|
axe $(URLS) --chrome-options $(CHROME_FLAGS_COMMA) --chromedriver-path=$(CHROMEDRIVER_PATH) --show-errors
|
||||||
axe-ff:
|
axe-ff:
|
||||||
|
@ -32,7 +34,17 @@ equal-access:
|
||||||
@echo $(URLS) | tr ' ' '\n' >urls.txt
|
@echo $(URLS) | tr ' ' '\n' >urls.txt
|
||||||
achecker --reportLevels violation,recommendation,potentialrecommendation urls.txt
|
achecker --reportLevels violation,recommendation,potentialrecommendation urls.txt
|
||||||
rm 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
|
|
||||||
|
|
12
content/notes/browser-development-moratorium.md
Normal file
12
content/notes/browser-development-moratorium.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
title: "Browser development moratorium"
|
||||||
|
date: 2022-06-18T13:38:34-07:00
|
||||||
|
---
|
||||||
|
|
||||||
|
What if Firefox and Chromium placed a year-long moratorium on all new browser features unrelated to security, accessibility, and internationalization? Effort not spent on those initiatives could be re-directed towards bugfixes.
|
||||||
|
|
||||||
|
Defining the word "major" might be hard but I think it's an interesting idea.
|
||||||
|
|
||||||
|
I'm not too worried about including Safari since it could spend those months catching up.
|
||||||
|
|
||||||
|
Inspired by a similar article by {{<mention-work>}}{{<indieweb-person name="Peter-Paul Koch" url="https://www.quirksmode.org/about/">}}: {{<cited-work name="Stop pushing the web forward" url="https://www.quirksmode.org/blog/archives/2015/07/stop_pushing_th.html">}}{{</mention-work>}}
|
|
@ -60,7 +60,7 @@
|
||||||
{{- if .Params.replyURI -}}
|
{{- if .Params.replyURI -}}
|
||||||
{{- partial "reply-context" .Params | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | safeHTML }}
|
{{- partial "reply-context" .Params | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | safeHTML }}
|
||||||
{{- end -}}
|
{{- 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 `<meta content="true" ?/>` "" | safeHTML }}
|
||||||
</div>
|
</div>
|
||||||
</content>
|
</content>
|
||||||
{{- $type := "article" -}}
|
{{- $type := "article" -}}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||||
<guid>{{ .Permalink }}</guid>
|
<guid>{{ .Permalink }}</guid>
|
||||||
<description>{{- .Content | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | html -}}</description>
|
<description xml:base="{{ .Permalink }}">{{- .Content | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | html -}}</description>
|
||||||
</item>
|
</item>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</channel>
|
</channel>
|
||||||
|
|
|
@ -5,7 +5,7 @@ set -e -u
|
||||||
# the name of this program
|
# the name of this program
|
||||||
progname="$(basename "${0}")"
|
progname="$(basename "${0}")"
|
||||||
|
|
||||||
help_text="Usage:
|
help_text="Usage: $progname [BASEURL]
|
||||||
|
|
||||||
Validate the site's markup, CSS, and accessibility.
|
Validate the site's markup, CSS, and accessibility.
|
||||||
|
|
||||||
|
@ -20,13 +20,10 @@ accessibility on every page in the sitemap.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h Print this help and exit
|
-h Print this help and exit
|
||||||
-b Base URL of site
|
|
||||||
"
|
"
|
||||||
|
|
||||||
# TODO: add the following:
|
# TODO: add the following:
|
||||||
# - check broken internal links
|
# - validate JSON schema (web app manifest, webfinger)
|
||||||
# - check broken webring links
|
|
||||||
# - validate JSON (web app manifest, webfinger)
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf '%s' "${help_text}"
|
printf '%s' "${help_text}"
|
||||||
|
@ -40,18 +37,12 @@ bad_option() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
base_url='http://localhost:8089/'
|
|
||||||
|
|
||||||
while getopts "hb" flags; do
|
while getopts "hb" flags; do
|
||||||
case ${flags} in
|
case ${flags} in
|
||||||
h)
|
h)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
b)
|
|
||||||
base_url="$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
bad_option "${flags}" 'invalid option'
|
bad_option "${flags}" 'invalid option'
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -59,8 +50,10 @@ while getopts "hb" flags; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
base_url="${1-http://localhost:8089}"
|
||||||
|
|
||||||
# HTML validation is already parallelized, so run that single-threaded.
|
# 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 -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
|
# vi:ft=sh
|
||||||
|
|
76
scripts/bin/validate-feed
Executable file
76
scripts/bin/validate-feed
Executable file
|
@ -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 <option> <reason>
|
||||||
|
bad_option() {
|
||||||
|
echo "${progname}: option ${1}: ${2}" >&2
|
||||||
|
usage >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts "ho" flags; do
|
||||||
|
case ${flags} in
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
bad_option "${flags}" 'invalid option'
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
url="$1"
|
||||||
|
|
||||||
|
|
||||||
|
find_rel_mention_count() {
|
||||||
|
curl -s "$url" | grep -cF 'rel="mentioned"'
|
||||||
|
}
|
||||||
|
|
||||||
|
rel_mention_count="$(find_rel_mention_count)"
|
||||||
|
|
||||||
|
run_validator() {
|
||||||
|
"$GHQ_ROOT/github.com/w3c/feedvalidator/src/demo.py" "$url"
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_feed() {
|
||||||
|
rel_mention_string="Unregistered link relationship \($rel_mention_count occurrence"
|
||||||
|
if [ "$rel_mention_count" = '1' ]; then
|
||||||
|
rel_mention_string="Unregistered link relationship"
|
||||||
|
fi
|
||||||
|
|
||||||
|
full_regex="Use of unknown namespace|Self reference doesn't match|should not contain (role|aria-labelledby|aria-label|aria-describedby) attribute|$rel_mention_string|entries with the same value|Validating $url"
|
||||||
|
|
||||||
|
run_validator \
|
||||||
|
| grep -Ev "$full_regex"
|
||||||
|
}
|
||||||
|
|
||||||
|
validator_output="$(validate_feed)"
|
||||||
|
if [ "$validator_output" = '' ]; then
|
||||||
|
echo "Feed is valid"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Feed errors found!" 1>&2
|
||||||
|
echo "$validator_output"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# vi:ft=sh
|
Loading…
Reference in a new issue