mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-30 15:22:09 +00:00
Compare commits
No commits in common. "9d6f7f220996b9ecacdfe0d455fb5d958e721150" and "9e54f9321f8ea7b6f583910b85a1a9d9b4775e02" have entirely different histories.
9d6f7f2209
...
9e54f9321f
3 changed files with 4 additions and 10 deletions
|
@ -24,7 +24,6 @@ Before deploying, I use some tools to process the output.
|
|||
|
||||
- `xmllint`, part of libxml2, to format the generated polygot XHTML5 markup.
|
||||
- [sd](https://github.com/chmln/sdA) (for advanced multi-line regex operations, much of which exist to fix `xmllint`'s output)
|
||||
- a patched version of html-tidy
|
||||
|
||||
I also apply static compression at max levels, using the following tools:
|
||||
|
||||
|
|
|
@ -4,5 +4,3 @@ char-encoding: utf8
|
|||
input-encoding: utf8
|
||||
output-xhtml: yes
|
||||
quiet: yes
|
||||
indent: no
|
||||
tidy-mark: no
|
||||
|
|
|
@ -24,15 +24,11 @@ cleanup() {
|
|||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
run_tidy () {
|
||||
tidy -asxhtml -config linter-configs/tidy.conf 2>/dev/null || true
|
||||
}
|
||||
|
||||
# delete the stylesheet from the html file; we'll re-insert it later.
|
||||
# Also remove two indentation levels
|
||||
sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 | sd '^\t(?:\t)?' '' | run_tidy >"$tmp_file"
|
||||
sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 | sd '^\t(?:\t)?' '' >"$tmp_file"
|
||||
{
|
||||
head -n7 "$tmp_file"
|
||||
head -n7 "$tmp_file" | sd -s '/>' ' />'
|
||||
cat "$OUTPUT_DIR/tmp.css"
|
||||
# shellcheck disable=SC2016 # these are regex statements, not shell expressions
|
||||
tail -n +8 "$tmp_file" \
|
||||
|
@ -42,5 +38,6 @@ sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 | s
|
|||
| sd -s ' ' ' ' \
|
||||
| sd -f m 'class="u-photo photo"[^<]*<' 'class="u-photo photo"/> <' \
|
||||
| sd '([a-z])<(data|time)' '$1 <$2' \
|
||||
| sd '</span>(<a[^>]*rel="(?:nofollow ugc|ugc nofollow)"(?:[^>]*)?>liked</a>)' '</span> $1'
|
||||
| sd '</span>(<a[^>]*rel="(?:nofollow ugc|ugc nofollow)"(?:[^>]*)?>liked</a>)' '</span> $1' \
|
||||
| sd '([^ ])/>' '$1 />'
|
||||
} >"$html_file"
|
||||
|
|
Loading…
Reference in a new issue