1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 21:12:48 +02:00

We now generate and link delta PDFs with the state(s) of the sheet.

- scripts/schhist2web: keep latest version of a sheet's PDF in pdf_head
  instead of pdf_$head, so that we don't overwrite it later with a delta
- scripts/schhist2web: for each change, write an HTML file which loads
  the image and links to a delta PDF
- scripts/schps2pdf: new option -T to specify page titles
- scripts/Makefile (UPLOAD): also upload html_*
This commit is contained in:
Werner Almesberger 2010-08-30 06:05:57 -03:00
parent 6bef1d9458
commit 66cf6a296e
3 changed files with 38 additions and 7 deletions

View File

@ -1,6 +1,6 @@
SHELL = /bin/bash
UPLOAD = {index.html,unchanged.png,thumb_*,diff_*,pdf_*}
UPLOAD = {index.html,unchanged.png,thumb_*,diff_*,pdf_*,html_*}
DEST = werner@host:/home/httpd/almesberger/misc/ben/
RSYNC = rsync -a --progress

View File

@ -264,10 +264,15 @@ EOF
while read m; do
ps="$cache/ps_$head/$m.ps"
if [ -r "$ps" ]; then
mkdir -p "$out/pdf_$head"
schps2pdf -o "$out/pdf_$head/$m.pdf" "$ps" || exit
#
# Note: we read from variable ps_$head but we write to constant
# pdf_head. We can't use pdf_$head here, because that may just be a
# commit with a change and we thus generate a delta PDF below.
#
mkdir -p "$out/pdf_head"
schps2pdf -o "$out/pdf_head/$m.pdf" "$ps" || exit
all="$all \"$ps\""
echo "<TD><A href=\"pdf_$head/$m.pdf\"><B>$m</B></A>"
echo "<TD><A href=\"pdf_head/$m.pdf\"><B>$m</B></A>"
else
echo "<TD><B>$m</B>"
fi
@ -303,16 +308,25 @@ for n in `cd "$dir" && git rev-list $first..HEAD~1` $first; do
fi
pngdiff shrink "$thumb" -f $THUMB_OPTS "$fat_a" "$fat_b" \
"$a" "$b" || exit
mkdir -p "$out/pdf_$next"
schps2pdf -T BEFORE -T AFTER -o "$out/pdf_$next/$m.pdf" \
"$cache/ps_$n/$m.ps" "$cache/ps_$next/$m.ps" || exit
elif [ -f "$a" ]; then
s="$s<TD>"
pngdiff cat "$diff" -f -c 1,0,0 "$a" "$a" || exit
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 1,0,0 "$fat_a" "$fat_a" \
|| exit
mkdir -p "$out/pdf_$next"
schps2pdf -T DELETED -o "$out/pdf_$next/$m.pdf" \
"$cache/ps_$n/$m.ps" || exit
elif [ -f "$b" ]; then
s="$s<TD>"
pngdiff cat "$diff" -f -c 0,1,0 "$b" "$b" || exit
pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$fat_b" "$fat_b" \
|| exit
mkdir -p "$out/pdf_$next"
schps2pdf -T NEW -o "$out/pdf_$next/$m.pdf" \
"$cache/ps_$next/$m.ps" || exit
else
s="$s<TD>"
continue
@ -320,7 +334,16 @@ for n in `cd "$dir" && git rev-list $first..HEAD~1` $first; do
echo "$s" >>"$index"
s=
empty=false
echo "<A href=\"diff_$next/$m.png\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$index"
mkdir -p "$out/html_$next"
echo "<A href=\"html_$next/$m.html\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$index"
cat <<EOF >"$out/html_$next/$m.html"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<TITLE>$m</TITLE>
<BODY>
<A href="../pdf_$next/$m.pdf"><IMG src="../diff_$next/$m.png"></A>
</BODY>
EOF
done < <(ls -1 "$out/names")
if ! $empty; then
echo "$s<TD valign=\"middle\">" >>"$index"

View File

@ -18,6 +18,8 @@ usage()
usage: $0 [options] [-o file.pdf] [file.ps ...]
-t prefix make a table of content. Remove prefix from file names.
-T title make a table of content using the specified title. Each
sheet needs one -T option.
EOF
exit 1
}
@ -34,6 +36,10 @@ while true; do
toc=true
prefix="$2"
shift 2;;
-T) [ -z "$2" ] && usage
toc=true
titles="$titles \"$2\""
shift 2;;
-*)
usage;;
*)
@ -45,7 +51,9 @@ in=${1:--}
shift
eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\""$out\"" -f \
`for n in "$in" "$@"; do \
`export i=1; for n in "$in" "$@"; do \
i=\`expr $i + 1\`;
echo "<(sheet=\`basename \"$n\" .ps\`;
$toc && echo '[ /Title ('\"\\${sheet#$prefix}\"') /OUT pdfmark';
set x $titles; i=\`expr $i + 1\`; eval t='\\$$i';
$toc && echo '[ /Title ('\"\\${t:-\\${sheet#$prefix}}\"') /OUT pdfmark';
cat \"$n\";)"; done`