1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 20:51:33 +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"
shift
done
cmd=
first=true
for n in `sed '/\$Sheet/,/\$EndSheet/p;d' "$1" |
sed '/F1 "\([^"]*\)" .*/s//\1/p;d'`; do
$quiet || echo "$n" 1>&2
./sch2fig $template $libs `dirname "$1"`/$n | fig2dev -L pdf >_tmp.pdf
sheet=false
while read line; do
if ! $sheet; then
[ "${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
mv _tmp.pdf "$out"
first=false
@ -45,4 +63,5 @@ for n in `sed '/\$Sheet/,/\$EndSheet/p;d' "$1" |
pdfunite "$out" _tmp.pdf _tmp2.pdf
mv _tmp2.pdf "$out"
fi
done
done <"$1"
exit