1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-30 15:22:09 +00:00

Compare commits

..

No commits in common. "88df7ba119409b973c678eab8edfb0e74ebc9e5c" and "dcb19779cec425745fa597dc327de7073162605f" have entirely different histories.

2 changed files with 9 additions and 8 deletions

View file

@ -29,7 +29,7 @@ run_tidy () {
# delete the stylesheet from the html file; we'll re-insert it later. # delete the stylesheet from the html file; we'll re-insert it later.
# Also remove two indentation levels # Also remove two indentation levels
sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 >"$tmp_file" sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 | run_tidy >"$tmp_file"
{ {
head -n7 "$tmp_file" head -n7 "$tmp_file"
cat "${OUTPUT_DIR:?}/tmp.css" cat "${OUTPUT_DIR:?}/tmp.css"
@ -37,12 +37,12 @@ sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | tail -n +2 >"$
#shellcheck source=/home/rkumar/Executables/ghq/git.sr.ht/~seirdy/seirdy.one/scripts/xhtmlize.sh #shellcheck source=/home/rkumar/Executables/ghq/git.sr.ht/~seirdy/seirdy.one/scripts/xhtmlize.sh
sed \ sed \
-e '1,7d' \ -e '1,7d' \
-e "s|name=\"generator\" />|name=\"generator\" />\n${TIDY:?}|" \
-e 's|\.svg" width="16" /><span|.svg" width="16" /> <span|' \
-e 's|</span>(&nbsp;)?.span itemprop="familyName|</span>&#160;<span itemprop="familyName"|' \ -e 's|</span>(&nbsp;)?.span itemprop="familyName|</span>&#160;<span itemprop="familyName"|' \
-e 's|class="u-photo photo"[^<]*<|class="u-photo photo"/> <|' \
-E \ -E \
-e 's|([a-z])<data|\1 <data|' \ -e 's|([a-z])<data|\1 <data|' \
-e 's#</span>(<a[^>]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked</a>)#</span> \1#' \ -e 's#</span>(<a[^>]*rel="(nofollow ugc|ugc nofollow)"([^>]*)?>liked</a>)#</span> \1#' \
-e 's#^[\t\s]*<(code|/pre)#<\1#' \ -e 's#<pre( tabindex="0")?>\n(\t|\s)*<(code|samp)( |>)#<pre tabindex="0"><\3\4#' \
"$tmp_file" \ "$tmp_file"
| awk '/^<\/code>/{printf "%s",$0;next}7'
} >"$html_file" } >"$html_file"

View file

@ -8,9 +8,10 @@ set -e -u
output_dir="$1" output_dir="$1"
script_dir="$(dirname "$0")" script_dir="$(dirname "$0")"
{ tidy_version="$(tidy -version)"
printf '\t' && sed -e '7q;d' "$output_dir/index.html" export TIDY="<meta content=\"$tidy_version\" name=\"generator\" />"
} >"$output_dir/tmp.css"
sed -e '7q;d' "$output_dir/index.html" | tr -d '\t' >"$output_dir/tmp.css"
cleanup() { cleanup() {
rm -f "$output_dir/tmp.css" rm -f "$output_dir/tmp.css"
} }