mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02:09 +00:00
xhtmlize: avoid race between parallel jobs
Prevent parallel jobs from accessing the same tmp.css
This commit is contained in:
parent
b39fcc6b78
commit
dc2b049eb3
2 changed files with 4 additions and 3 deletions
|
@ -29,7 +29,7 @@ trap cleanup EXIT
|
|||
sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | sd '^\t(?:\t)?' '' >"$tmp_file"
|
||||
{
|
||||
head -n7 "$tmp_file" | sd -s '/>' ' />'
|
||||
cat tmp.css
|
||||
cat "$OUTPUT_DIR/tmp.css"
|
||||
# shellcheck disable=SC2016 # these are regex statements, not shell expressions
|
||||
tail -n +8 "$tmp_file" \
|
||||
| sd '<pre(?: tabindex="0")?>\n\t*<(code|samp)( |>)' '<pre tabindex="0"><$1$2' \
|
||||
|
|
|
@ -8,12 +8,13 @@ set -e -u
|
|||
output_dir="$1"
|
||||
script_dir="$(dirname "$0")"
|
||||
|
||||
printf '<style>%s</style>\n' "$(htmlq -t style <"$output_dir/index.html")" >tmp.css
|
||||
printf '<style>%s</style>\n' "$(htmlq -t style <"$output_dir/index.html")" >"$output_dir/tmp.css"
|
||||
cleanup() {
|
||||
rm -f "tmp.css"
|
||||
rm -f "$output_dir/tmp.css"
|
||||
}
|
||||
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"
|
||||
# done
|
||||
|
|
Loading…
Reference in a new issue