1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

Auto-format markup in CI

Use xmlfmt with some extra post-processing since xmlfmt has a few
issues wrt extra newlines.
This commit is contained in:
Rohan Kumar 2022-06-01 17:30:47 -07:00
parent 874414229e
commit 425071eade
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
5 changed files with 121 additions and 119 deletions

View file

@ -1,9 +1,13 @@
---
# we rsync binaries.tar.gz from the same server we deploy to.
# it contains these static-pie binaries:
# hugo, brotli, ect (like gzip/zopfli), sd, and xmlfmt.
image: alpine/edge
packages:
- rsync
- git # for Hugo's gitInfo
- bmake
- moreutils
sources:
- https://git.sr.ht/~seirdy/seirdy.one
secrets:

View file

@ -42,9 +42,6 @@
{{- end }}
{{ $icon_192 := resources.Get "/apple-touch-icon.png" | resources.Fingerprint "md5" }}
{{- printf `<link rel="icon" sizes="192x192" href="%s" type="image/png" />` $icon_192.RelPermalink | safeHTML -}}
{{ $favicon := resources.Get "/favicon.png" -}}
{{ $favicon_base64 := $favicon.Content | base64Encode }}
{{ printf `<link rel="icon" sizes="32x32" href="data:image/png;base64,%s" type="image/png" />` $favicon_base64 | safeHTML }}
<meta name="color-scheme" content="light dark" />
<meta name="format-detection" content="telephone=no" /><!-- Why does apple do this -->
<meta name="theme-color" content="#111" media="(prefers-color-scheme:dark)" />

View file

@ -55,5 +55,5 @@
<dd>This post does not have any approved Webmentions yet.</dd>
{{- end }}
</dl>
<p></p>
<p>Feel free to contact me directly with feedback; <a href="{{ .Site.BaseURL }}about/#location-seirdy-online">heres my contact info</a></p>
</section>

View file

@ -5,7 +5,8 @@
# XML tooling.
# this means that every index.html file has an equivalent index.xhtml file.
# content negotiation allows an agent to pick html or xhtml.
# echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
find "$1" -type f -name '*.html' \
-exec sh -c 'echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | cat - "$0" | grep -Fv "<meta charset=\"UTF-8\" />" >"${0%*.html}.xhtml"' {} \;
-exec sh -c 'echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >"${0%*.html}.xhtml" && xmlfmt -i " " -f "$0" | busybox sed -e :a -e "/./,\$!d;/^\n*\$/{\$d;N;};/\n\$/ba" | sd -f m "\n(?:\t*)?</" "</" | sd -f m "<pre>\n\t*<code" "<pre><code" | pee "sed 5d >>\"${0%*.html}.xhtml\"" "sponge \"$0\""' {} \;
# done