1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
#!/bin/sh
#
# $Id: makeimages,v 1.3 2006/02/26 19:33:59 danmc Exp $
# This script requires the following packages :
# - gschem (located the your PATH )
# - ghostscript (I use aladdin gs)
#
if [ "$1" == "" ]
then
echo "usage: makeimages path_to_libary"
exit 1
fi
version=`libgeda-config --version`
basedir=`basename $1`
echo Creating $basedir
if [ -e $basedir ]
then
echo Removing old $basedir
rm -rf $basedir/*
else
mkdir $basedir
fi
# do basic html stuff
echo "<HTML> <HEAD> <TITLE> gEDA: $basedir library symbols </TITLE> </HEAD>" > ${basedir}/index.html
echo "<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\" LINK=\"#00FF00\" VLINK=\"#00DDDD\">" >> ${basedir}/index.html
echo "" >> ${basedir}/index.html
echo "<font face=\"arial,helvetica\">" >> ${basedir}/index.html
echo "" >> ${basedir}/index.html
echo "<CENTER><H1>$basedir library</H1></CENTER>" >> ${basedir}/index.html
echo "" >> ${basedir}/index.html
# setup small.html
echo "<HTML> <HEAD> <TITLE> gEDA: $basedir library symbols </TITLE> </HEAD>" > ${basedir}/small.html
echo "<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\" LINK=\"#00FF00\" VLINK=\"#00DDDD\">" >> ${basedir}/small.html
echo "" >> ${basedir}/small.html
echo "<font face=\"arial,helvetica\">" >> ${basedir}/small.html
echo "" >> ${basedir}/small.html
echo "<CENTER><H1>$basedir library</H1></CENTER>" >> ${basedir}/small.html
echo "" >> ${basedir}/small.html
echo "" >> ${basedir}/small.html
echo "<H3>Click on the symbol for detailed information</H3>" >> ${basedir}/small.html
echo "" >> ${basedir}/small.html
# Clear textlist.html
echo "" > ${basedir}/textlist.html
# now start going over each .sym file in the library
for i in $1/*.sym
do
symname=`basename $i .sym`
echo $i $symname ${basedir}/${symname}.ps
# Create a copy of the .sym for the directory (refenced by the per
# symbol .html page
cp -f $i $basedir
# First create postscript file using gschem and print.scm
gschem -o ${basedir}/${symname}.ps \
-s print.scm \
-p \
$i
# Then take postscript file and create thumbnail ppm
# GNU ghostscript:
# use this if you have Aladdin 5.50 ghostscript:
#gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 \
gs -q \
-dNOPAUSE -sOutputFile=${basedir}/${symname}_tn.png \
-r20 -sDEVICE=png16 \
${basedir}/${symname}.ps quit.ps
#
# make a really really small thumbnail
#
gs -q \
-dNOPAUSE -sOutputFile=${basedir}/${symname}_stn.png \
-r5 -sDEVICE=png16 \
${basedir}/${symname}.ps quit.ps
# Then take original postscript file and convert to png16
# GNU ghostscript:
# use this if you have Aladdin 5.50 ghostscript:
#gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 \
gs -q -r100 \
-dNOPAUSE -sOutputFile=${basedir}/${symname}.png \
-sDEVICE=png16 \
${basedir}/${symname}.ps quit.ps
# Add entry to index.html
echo "<IMG SRC=\"./${symname}_tn.png\">" >> ${basedir}/index.html
echo "<H3><A HREF=\"./${symname}.sym\">${symname}.sym</A>" >> ${basedir}/index.html
echo "<A HREF="./${symname}.png">PNG</A> <A HREF="./${symname}.ps">PS</A></H3>" >> ${basedir}/index.html
echo "<p><br>" >> ${basedir}/index.html
# Add entry to small.html
echo -n "<A HREF=\"./${symname}.html\">" >> ${basedir}/small.html
echo -n "<IMG SRC=\"./${symname}_stn.png\" alt=\"${symname}\" border=0>" >> ${basedir}/small.html
echo "</A>" >> ${basedir}/small.html
# Create per sym html file
echo "<HTML> <HEAD> <TITLE> gEDA: $basedir/$symname symbol </TITLE> </HEAD>" > ${basedir}/$symname.html
echo "<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\" LINK=\"#00FF00\" VLINK=\"#00DDDD\">" >> ${basedir}/$symname.html
echo "" >> ${basedir}/$symname.html
echo "<font face=\"arial,helvetica\">" >> ${basedir}/${symname}.html
echo "" >> ${basedir}/$symname.html
echo "<CENTER><H1>$basedir/$symname library</H1></CENTER>" >> ${basedir}/$symname.html
echo "" >> ${basedir}/$symname.html
echo "<IMG SRC=\"./${symname}_tn.png\">" >> ${basedir}/$symname.html
echo "<H3><A HREF=\"./${symname}.sym\">${symname}.sym</A>" >> ${basedir}/$symname.html
echo "<A HREF="./${symname}.png">PNG</A> <A HREF="./${symname}.ps">PS</A></H3>" >> ${basedir}/$symname.html
echo "<p><br>" >> ${basedir}/$symname.html
echo "" >> ${basedir}/$symname.html
echo "<H5>Automatically extracted from symbol library: ${basedir} version ${version}</H5>" >> ${basedir}/$symname.html
echo "" >> ${basedir}/$symname.html
echo "<H3> <A HREF=\"small.html\">Up one level</A> </H3>" >> ${basedir}/$symname.html
echo "" >> ${basedir}/$symname.html
echo "</BODY> </HTML>" >> ${basedir}/$symname.html
# Added text link to small.html (added after everything is done)
echo "<A HREF=\"$symname.html\">$symname</A>" >> ${basedir}/textlist.html
rm -f ${basedir}/*.ppm
done
# basic html
echo "" >> ${basedir}/index.html
echo "<H5>Automatically extracted from symbol library: ${basedir} version ${version}</H5>" >> ${basedir}/index.html
echo "" >> ${basedir}/index.html
echo "<H3> <A HREF=\"../index.html\">Up one level</A> </H3>" >> ${basedir}/index.html
echo "" >> ${basedir}/index.html
echo "</BODY> </HTML>" >> ${basedir}/index.html
# small.html
echo "" >> ${basedir}/small.html
echo "<H3>" >> ${basedir}/small.html
cat ${basedir}/textlist.html >> ${basedir}/small.html
echo "</H3>" >> ${basedir}/small.html
echo "<H5>Automatically extracted from symbol library: ${basedir} version ${version}</H5>" >> ${basedir}/small.html
#echo "<p><br>" >> ${basedir}/small.html
echo "" >> ${basedir}/small.html
echo "<H3> <A HREF=\"../index.html\">Up one level</A> </H3>" >> ${basedir}/small.html
echo "" >> ${basedir}/small.html
echo "</BODY> </HTML>" >> ${basedir}/small.html
rm ${basedir}/textlist.html
|