mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-12-28 14:12:24 +02:00
Sheet names now link to the sheet's PDF.
- scripts/normalizeschps: by default, don't change the linewidth - scripts/schhist2web: cache historical Postscript files in directories ps_* - scripts/schps2pdf: new script to convert eeschema Postscript to PDF - scripts/schhist2web: link the file name in the title to the curent PDF of the respective sheet - scripts/Makefile: changed lazy wildcard thum* to thumb_* and diff* to diff_* - scripts/Makefile: upload also pdf_*
This commit is contained in:
parent
800577353e
commit
337f13a0df
@ -1,6 +1,6 @@
|
||||
SHELL = /bin/bash
|
||||
|
||||
UPLOAD = {index.html,unchanged.png,thum*,diff*}
|
||||
UPLOAD = {index.html,unchanged.png,thumb_*,diff_*,pdf_*}
|
||||
DEST = werner@host:/home/httpd/almesberger/misc/ben/
|
||||
RSYNC = rsync -a --progress
|
||||
|
||||
|
@ -12,24 +12,22 @@
|
||||
#
|
||||
|
||||
|
||||
LINEWIDTH=120
|
||||
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF 1>&2
|
||||
usage: $0 [options] [in.ps [out.ps]]
|
||||
|
||||
-w points Postscript line width (default: $LINEWIDTH)
|
||||
-w points Postscript line width (default: use the original)
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
width=
|
||||
while true; do
|
||||
case "$1" in
|
||||
-w) [ -z "$2" ] && usage
|
||||
LINEWIDTH="$2"
|
||||
width="$2"
|
||||
shift 2;;
|
||||
-*)
|
||||
usage;;
|
||||
@ -45,8 +43,9 @@ out=${2:-/dev/stdout}
|
||||
sed '
|
||||
1c%!PS-Adobe-3.0\
|
||||
currentdict /DidNormalize known not { \
|
||||
/setlinewidth { '$LINEWIDTH' 2 copy lt { exch } if pop \
|
||||
setlinewidth } bind def \
|
||||
'"`[ -z \"$width\" ] ||
|
||||
echo \"/setlinewidth { $width 2 copy lt { exch } if pop \
|
||||
setlinewidth } bind def \"`"' \
|
||||
/rectfill { rectstroke } bind def \
|
||||
/DidNormalize true def \
|
||||
} if \
|
||||
|
@ -193,8 +193,8 @@ for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
|
||||
tmp=`pwd`/_schhist2web
|
||||
trap "rm -rf \"$cache/ppm_$n\" \"$cache/fat_$n\" \"$tmp\"" 0
|
||||
if [ ! -d "$cache/ppm_$n" ]; then
|
||||
rm -rf "$cache/ppm_$n" "$cache/fat_$n"
|
||||
mkdir "$cache/ppm_$n" "$cache/fat_$n"
|
||||
rm -rf "$cache/ppm_$n" "$cache/fat_$n" "$cache/ps_$n"
|
||||
mkdir "$cache/ppm_$n" "$cache/fat_$n" "$cache/ps_$n"
|
||||
#
|
||||
# potential optimization here: remember Postscript files from previous
|
||||
# run (or their md5sum) and check if they have changed. If not, skip
|
||||
@ -204,9 +204,11 @@ for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
|
||||
gitsch2ps $sanitize "$dir" "$schname" $n "$tmp" || exit
|
||||
for m in "$tmp"/*.ps; do
|
||||
ppm="$cache/ppm_$n/`basename "$m" .ps`.ppm"
|
||||
normalizeschps "$m" | schps2ppm - "$ppm" || exit
|
||||
normalizeschps -w 120 "$m" | schps2ppm - "$ppm" || exit
|
||||
ppm="$cache/fat_$n/`basename "$m" .ps`.ppm"
|
||||
normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit
|
||||
ps="$cache/ps_$n/`basename "$m"`"
|
||||
normalizeschps "$m" "$ps" || exit
|
||||
done
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
@ -257,7 +259,9 @@ EOF
|
||||
<TR bgcolor="$FNAME_COLOR">
|
||||
EOF
|
||||
while read m; do
|
||||
echo "<TD><B>$m</B>"
|
||||
mkdir -p "$out/pdf_$head"
|
||||
schps2pdf -o "$out/pdf_$head/$m.pdf" "$cache/ps_$head/$m.ps" || exit
|
||||
echo "<TD><A href="pdf_$head/$m.pdf"><B>$m</B></A>"
|
||||
done < <(ls -1 "$out/names")
|
||||
} >"$index"
|
||||
|
||||
|
52
scripts/schps2pdf
Executable file
52
scripts/schps2pdf
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# schps2pdf - Generate PDF files from Eeschema Postscript
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF 1>&2
|
||||
usage: $0 [options] [-o file.pdf] [file.ps ...]
|
||||
|
||||
-t prefix make a table of content. Remove prefix from file names.
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
toc=false
|
||||
out=-
|
||||
while true; do
|
||||
case "$1" in
|
||||
-o) [ -z "$2" ] && usage
|
||||
out=$2
|
||||
shift 2;;
|
||||
-t) [ -z "$2" ] && usage
|
||||
toc=true
|
||||
prefix="$1"
|
||||
shift 2;;
|
||||
-*)
|
||||
usage;;
|
||||
*)
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
in=${1:--}
|
||||
shift
|
||||
|
||||
cat "$in" |
|
||||
eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\""$out\"" -f \
|
||||
`for n in "$in" "$@"; do \
|
||||
name=\`basename "$n" .ps\` \
|
||||
echo "<($toc && echo '[ /Title (${name#$prefix}) /OUT pdfmark';
|
||||
cat \"$n\";)"; done`
|
Loading…
Reference in New Issue
Block a user