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

Decrease markup indentation by one level

This commit is contained in:
Rohan Kumar 2022-06-04 22:36:55 -07:00
parent fb741f3e6f
commit 9433bca2b7
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 3 additions and 2 deletions

View file

@ -11,6 +11,7 @@
# xmllint ruins inline CSS so delete the inline CSS and re-insert it. # xmllint ruins inline CSS so delete the inline CSS and re-insert it.
# xmllint also adds extra whitespace around <pre><code> which we remove # xmllint also adds extra whitespace around <pre><code> which we remove
# with "sd". I chose sd since it handles newlines well. # with "sd". I chose sd since it handles newlines well.
# It also decreases indents by one level
set -e -u set -e -u
@ -24,7 +25,7 @@ cleanup() {
trap cleanup EXIT trap cleanup EXIT
trap cleanup EXIT trap cleanup EXIT
sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - -o "$tmp_file" sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | sd '^\t' '' >"$tmp_file"
{ {
head -n7 "$tmp_file" head -n7 "$tmp_file"
cat tmp.css cat tmp.css

View file

@ -7,7 +7,7 @@ set -e -u
output_dir="$1" output_dir="$1"
script_dir="$(dirname "$0")" script_dir="$(dirname "$0")"
printf '\t\t<style>%s</style>\n' "$(htmlq -t style <"$output_dir/index.html")" >tmp.css printf '\t<style>%s</style>\n' "$(htmlq -t style <"$output_dir/index.html")" >tmp.css
cleanup() { cleanup() {
rm -f "tmp.css" rm -f "tmp.css"
} }