Date:2010-08-30 11:05:57 (9 years 4 months ago)
Author:Werner Almesberger
Commit:66cf6a296ec30f5bbda7ebe1eb59c2041c656a87
Message: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_*
Files: scripts/Makefile (1 diff)
scripts/schhist2web (3 diffs)
scripts/schps2pdf (3 diffs)

Change Details

scripts/Makefile
11SHELL = /bin/bash
22
3UPLOAD = {index.html,unchanged.png,thumb_*,diff_*,pdf_*}
3UPLOAD = {index.html,unchanged.png,thumb_*,diff_*,pdf_*,html_*}
44DEST = werner@host:/home/httpd/almesberger/misc/ben/
55RSYNC = rsync -a --progress
66
scripts/schhist2web
264264    while read m; do
265265    ps="$cache/ps_$head/$m.ps"
266266    if [ -r "$ps" ]; then
267        mkdir -p "$out/pdf_$head"
268        schps2pdf -o "$out/pdf_$head/$m.pdf" "$ps" || exit
267        #
268        # Note: we read from variable ps_$head but we write to constant
269        # pdf_head. We can't use pdf_$head here, because that may just be a
270        # commit with a change and we thus generate a delta PDF below.
271        #
272        mkdir -p "$out/pdf_head"
273        schps2pdf -o "$out/pdf_head/$m.pdf" "$ps" || exit
269274        all="$all \"$ps\""
270        echo "<TD><A href=\"pdf_$head/$m.pdf\"><B>$m</B></A>"
275        echo "<TD><A href=\"pdf_head/$m.pdf\"><B>$m</B></A>"
271276    else
272277        echo "<TD><B>$m</B>"
273278    fi
...... 
303308        fi
304309        pngdiff shrink "$thumb" -f $THUMB_OPTS "$fat_a" "$fat_b" \
305310          "$a" "$b" || exit
311        mkdir -p "$out/pdf_$next"
312        schps2pdf -T BEFORE -T AFTER -o "$out/pdf_$next/$m.pdf" \
313          "$cache/ps_$n/$m.ps" "$cache/ps_$next/$m.ps" || exit
306314    elif [ -f "$a" ]; then
307315        s="$s<TD>"
308316        pngdiff cat "$diff" -f -c 1,0,0 "$a" "$a" || exit
309317        pngdiff shrink "$thumb" -f $THUMB_OPTS -c 1,0,0 "$fat_a" "$fat_a" \
310318          || exit
319        mkdir -p "$out/pdf_$next"
320        schps2pdf -T DELETED -o "$out/pdf_$next/$m.pdf" \
321          "$cache/ps_$n/$m.ps" || exit
311322    elif [ -f "$b" ]; then
312323        s="$s<TD>"
313324        pngdiff cat "$diff" -f -c 0,1,0 "$b" "$b" || exit
314325        pngdiff shrink "$thumb" -f $THUMB_OPTS -c 0,1,0 "$fat_b" "$fat_b" \
315326          || exit
327        mkdir -p "$out/pdf_$next"
328        schps2pdf -T NEW -o "$out/pdf_$next/$m.pdf" \
329          "$cache/ps_$next/$m.ps" || exit
316330    else
317331        s="$s<TD>"
318332        continue
...... 
320334    echo "$s" >>"$index"
321335    s=
322336    empty=false
323    echo "<A href=\"diff_$next/$m.png\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$index"
337    mkdir -p "$out/html_$next"
338    echo "<A href=\"html_$next/$m.html\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$index"
339    cat <<EOF >"$out/html_$next/$m.html"
340<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
341<HTML>
342<TITLE>$m</TITLE>
343<BODY>
344<A href="../pdf_$next/$m.pdf"><IMG src="../diff_$next/$m.png"></A>
345</BODY>
346EOF
324347    done < <(ls -1 "$out/names")
325348    if ! $empty; then
326349     echo "$s<TD valign=\"middle\">" >>"$index"
scripts/schps2pdf
1818usage: $0 [options] [-o file.pdf] [file.ps ...]
1919
2020  -t prefix make a table of content. Remove prefix from file names.
21  -T title make a table of content using the specified title. Each
22             sheet needs one -T option.
2123EOF
2224    exit 1
2325}
...... 
3436    toc=true
3537    prefix="$2"
3638    shift 2;;
39    -T) [ -z "$2" ] && usage
40    toc=true
41    titles="$titles \"$2\""
42    shift 2;;
3743    -*)
3844    usage;;
3945    *)
...... 
4551shift
4652
4753eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\""$out\"" -f \
48  `for n in "$in" "$@"; do \
54  `export i=1; for n in "$in" "$@"; do \
55    i=\`expr $i + 1\`;
4956    echo "<(sheet=\`basename \"$n\" .ps\`;
50      $toc && echo '[ /Title ('\"\\${sheet#$prefix}\"') /OUT pdfmark';
57    set x $titles; i=\`expr $i + 1\`; eval t='\\$$i';
58      $toc && echo '[ /Title ('\"\\${t:-\\${sheet#$prefix}}\"') /OUT pdfmark';
5159    cat \"$n\";)"; done`

Archive Download the corresponding diff file



interactive