From 9433bca2b7e2dfe3acb15bd9af0f609277aece85 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sat, 4 Jun 2022 22:36:55 -0700 Subject: [PATCH] Decrease markup indentation by one level --- scripts/xhtmlize-single-file.sh | 3 ++- scripts/xhtmlize.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/xhtmlize-single-file.sh b/scripts/xhtmlize-single-file.sh index 6c10fd1..75495af 100644 --- a/scripts/xhtmlize-single-file.sh +++ b/scripts/xhtmlize-single-file.sh @@ -11,6 +11,7 @@ # xmllint ruins inline CSS so delete the inline CSS and re-insert it. # xmllint also adds extra whitespace around
 which we remove
 # with "sd". I chose sd since it handles newlines well.
+# It also decreases indents by one level
 
 set -e -u
 
@@ -24,7 +25,7 @@ cleanup() {
 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"
 	cat tmp.css
diff --git a/scripts/xhtmlize.sh b/scripts/xhtmlize.sh
index 03d12ad..4c19525 100644
--- a/scripts/xhtmlize.sh
+++ b/scripts/xhtmlize.sh
@@ -7,7 +7,7 @@ set -e -u
 output_dir="$1"
 script_dir="$(dirname "$0")"
 
-printf '\t\t\n' "$(htmlq -t style <"$output_dir/index.html")" >tmp.css
+printf '\t\n' "$(htmlq -t style <"$output_dir/index.html")" >tmp.css
 cleanup() {
 	rm -f "tmp.css"
 }