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

Add cdata to style tag

This commit is contained in:
Rohan Kumar 2024-01-30 18:50:37 -05:00
parent 4e192084b2
commit 723bdb5a5d
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 7 additions and 6 deletions

View file

@ -40,7 +40,7 @@ run_xmllint() {
sed 7d "$html_file" | run_xmllint | tail -n +2 >"$tmp_file"
{
head -n7 "$tmp_file" | sed -e 's/^\t//'
cat "${OUTPUT_DIR:?}/tmp.css"
cat "${OUTPUT_DIR:?}/tmp.xhtml"
# 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 \

View file

@ -14,13 +14,14 @@ temp_resume="$(mktemp)"
# I have an alias for a redirect. I also define the redirect in Nginx, but this is there for the envs.net/~seirdy mirror. Hugo aliases don't have trailing slashes; this will trip up xmllint.
sed -i -e 's|<html lang="en-us"|<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"|' -E -e 's#<((link|meta) .*)">#<\1" />#' "$output_dir/resume/index.html"
mv "$output_dir/resume/index.html" "$temp_resume"
# {{ $css.Content | safeCSS }}/*]]>*/-->
{
sed -e '7q;d' "$output_dir/index.html"
} >"$output_dir/tmp.css"
sed -e '7q;d' "$output_dir/index.html" \
| sed -e 's|<style>|<style><\!--/\*--><\!\[CDATA\[/\*><\!--\*/|' -e 's|</style>|/\*\]\]>\*/--></style>|'
} >"$output_dir/tmp.xhtml"
cleanup() {
rm -f "$output_dir/tmp.css"
mv "$temp_resume" "$output_dir/resume/index.html"
rm "$output_dir/tmp.xhtml"
mv "$temp_resume" "$output_dir/resume/index.html"
}
trap cleanup EXIT