1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-30 08:56:13 +02:00

sch2fig/sch2pdf: extract sheet title and pass in variable TITLE

This commit is contained in:
Werner Almesberger 2016-07-26 03:16:09 -03:00
parent 2c9c526255
commit 466e3ae726

View File

@ -32,12 +32,30 @@ while [ "$2" ]; do
libs="$libs $1" libs="$libs $1"
shift shift
done done
cmd=
first=true first=true
for n in `sed '/\$Sheet/,/\$EndSheet/p;d' "$1" | sheet=false
sed '/F1 "\([^"]*\)" .*/s//\1/p;d'`; do while read line; do
$quiet || echo "$n" 1>&2 if ! $sheet; then
./sch2fig $template $libs `dirname "$1"`/$n | fig2dev -L pdf >_tmp.pdf [ "${line#\$Sheet}" != "$line" ] && sheet=true
continue
else
if [ "${line#\$EndSheet}" != "$line" ]; then
sheet=false
continue
fi
fi
if [ "${line#F0 \"}" != "$line" ]; then
name=${line#F0 \"}
name=${name%%\"*}
fi
[ "${line#F1 \"}" = "$line" ] && continue
file=${line#F1 \"}
file=${file%%\"*}
$quiet || echo "$file" 1>&2
./sch2fig "-DTITLE=$name" $template $libs `dirname "$1"`/$file |
fig2dev -L pdf >_tmp.pdf
if $first; then if $first; then
mv _tmp.pdf "$out" mv _tmp.pdf "$out"
first=false first=false
@ -45,4 +63,5 @@ for n in `sed '/\$Sheet/,/\$EndSheet/p;d' "$1" |
pdfunite "$out" _tmp.pdf _tmp2.pdf pdfunite "$out" _tmp.pdf _tmp2.pdf
mv _tmp2.pdf "$out" mv _tmp2.pdf "$out"
fi fi
done done <"$1"
exit