15 lines
828 B
Shell
15 lines
828 B
Shell
|
|
#!/bin/bash
|
||
|
|
# Erzeugt beide PDF-Varianten aus der Buch-README unter getrennten Namen: *.weasy.pdf und *.latex.pdf
|
||
|
|
# (in der README schreiben beide Befehle dieselbe Datei). Aufruf im Repo-Wurzelverzeichnis.
|
||
|
|
mkdir -p .qa
|
||
|
|
for dir in "$@"; do
|
||
|
|
mkdir -p "$dir/pandoc-logs"
|
||
|
|
grep -E '^pandoc .*\.pdf' "$dir/README.md" | while IFS= read -r cmd; do
|
||
|
|
case "$cmd" in *weasyprint*) kind=weasy;; *) kind=latex;; esac
|
||
|
|
cmd=$(printf '%s' "$cmd" | sed -E "s/\.pdf('?)\$/.$kind.pdf\1/")
|
||
|
|
s=$(date +%s)
|
||
|
|
(cd "$dir" && timeout 1800 bash -c "$cmd") > "$dir/pandoc-logs/$kind.out" 2> "$dir/pandoc-logs/$kind.err"; rc=$?
|
||
|
|
printf '%s\t%s\trc=%s\t%ss\n' "$(basename "$dir")" $kind $rc $(( $(date +%s)-s ))
|
||
|
|
printf '%s\trc=%s\tpandoc %s-PDF (%s)\n' "$(date -Iseconds)" $rc $kind "$(basename "$dir")" >> .qa/commands.log
|
||
|
|
done
|
||
|
|
done
|