mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-12-24 01:42:10 +00:00
Add HTML-Tidy's generator tag manually
It auto-inserts it to the start of <head> but I want it at the end.
This commit is contained in:
parent
6dbf6fa91c
commit
bbfa381368
3 changed files with 8 additions and 3 deletions
|
@ -5,6 +5,7 @@ input-encoding: utf8
|
|||
output-xhtml: yes
|
||||
quiet: yes
|
||||
indent: no
|
||||
# I set this manually
|
||||
tidy-mark: no
|
||||
quote-nbsp: no
|
||||
sort-attributes: alpha
|
||||
|
|
|
@ -17,7 +17,6 @@ set -e -u
|
|||
|
||||
html_file="$1"
|
||||
tmp_file="$(mktemp)"
|
||||
xhtml_file=${html_file%*.html}.xhtml
|
||||
|
||||
cleanup() {
|
||||
rm -f "$tmp_file"
|
||||
|
@ -33,10 +32,12 @@ run_tidy () {
|
|||
sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 | run_tidy >"$tmp_file"
|
||||
{
|
||||
head -n7 "$tmp_file"
|
||||
cat "$OUTPUT_DIR/tmp.css"
|
||||
cat "${OUTPUT_DIR:?}/tmp.css"
|
||||
# shellcheck disable=SC2016 # these are regex statements, not shell expressions
|
||||
#shellcheck source=/home/rkumar/Executables/ghq/git.sr.ht/~seirdy/seirdy.one/scripts/xhtmlize.sh
|
||||
sed \
|
||||
-e '1,7d' \
|
||||
-e "s|name=\"generator\" />|name=\"generator\" />\n${TIDY:?}|" \
|
||||
-e 's|\.svg" width="16" /><span|.svg" width="16" /> <span|' \
|
||||
-e 's|</span>( )?.span itemprop="familyName|</span> <span itemprop="familyName"|' \
|
||||
-E \
|
||||
|
|
|
@ -8,6 +8,9 @@ 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"
|
||||
|
@ -16,5 +19,5 @@ trap cleanup EXIT
|
|||
|
||||
export XMLLINT_INDENT=' '
|
||||
export OUTPUT_DIR="$output_dir"
|
||||
find "$output_dir" -type f -name '*.html' | xargs -n1 sh "$script_dir/xhtmlize-single-file.sh"
|
||||
find "$output_dir" -type f -name '*.html' -exec sh "$script_dir/xhtmlize-single-file.sh" {} \;
|
||||
# done
|
||||
|
|
Loading…
Reference in a new issue