1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-15 01:42:10 +00:00
seirdy.one/scripts/xhtmlize.sh
Rohan Kumar bbfa381368
Add HTML-Tidy's generator tag manually
It auto-inserts it to the start of <head> but I want it at the end.
2023-11-15 02:26:52 -08:00

23 lines
616 B
Bash

#!/bin/sh
# takes an arg for the output dir.
# Runs xhtmlize-single-file.sh on every single html file in the output dir.
# exits if xhtmlize-single-file fails.
set -e -u
output_dir="$1"
script_dir="$(dirname "$0")"
tidy_version="$(tidy -version)"
export TIDY="<meta content=\"$tidy_version\" name=\"generator\" />"
sed -e '7q;d' "$output_dir/index.html" | tr -d '\t' >"$output_dir/tmp.css"
cleanup() {
rm -f "$output_dir/tmp.css"
}
trap cleanup EXIT
export XMLLINT_INDENT=' '
export OUTPUT_DIR="$output_dir"
find "$output_dir" -type f -name '*.html' -exec sh "$script_dir/xhtmlize-single-file.sh" {} \;
# done