10,6 → 10,18 |
tmp="canvas_index" |
keys="keywords" |
datum=`date +%d-%m-%Y` |
htmlhead="<!DOCTYPE html><html><body>" |
htmltail="</body></html>" |
# these are only used to simulate a wims session |
export "w_wims_session"="example" |
export "w_session"="123" |
export "w_wims_home"="/var/wims/src/Misc" |
wims_tmp="/var/wims/src/Misc/sessions/example/getfile/" |
mkdir -p $wims_tmp |
# the popup html pages and corresponding javascript includes are locate here |
tmpdir="examples" |
rm -rf $tmpdir |
mkdir $tmpdir 2>/dev/null |
|
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\"> |
<html> |
32,37 → 44,54 |
cnt=0 |
br=8 |
while read line ; do |
chk=`echo $line | grep "@"` |
chk=`echo "$line" | grep "@"` |
if [ ! -z "$chk" ] ; then |
echo $line |
if [ $p -eq 0 ]; then |
string=`echo $line | tr '@' ' '` |
idx=`echo $string | awk '{ print $1 }'` |
echo ",'$idx'" >> $keys |
if [ $cnt -gt $br ]; then |
echo "</tr><tr>" >> $phtml |
cnt=0 |
fi |
cnt=$(($cnt+1)) |
echo "<td><a name='$idx top' href='#$idx'>$idx</a></td>" >> $phtml |
echo "<li><a name='$idx' href='#$idx top'>$string</a><ul>" >> $tmp |
p=1 |
else |
p=2 |
alt=`echo $line | grep "@ alternative :" | awk '{ print $4 }' | tr -d '[:blank:]'` |
if [ ! -z $alt ] ; then |
chk=`echo "$chk" | grep @%` |
if [ -z "$chk" ] ; then |
echo $line |
if [ $p -eq 0 ]; then |
string=`echo "$line" | tr '@' ' '` |
idx=`echo "$string" | awk '{ print $1 }'` |
echo ",'$idx'" >> $keys |
if [ $cnt -gt $br ]; then |
echo "</tr><tr>" >> $phtml |
cnt=0 |
fi |
cnt=$(($cnt+1)) |
echo ",'$alt'" >> $keys |
echo "<td><a name='$alt top' href='#$idx'>$alt</a></td>" >> $phtml |
echo "<li><span style=\"color:blue;font-size:0.8em\">alternative command:<a name='$alt' href='#$alt top'>$alt</a></span></li>" >> $tmp |
echo "<td><a name='$idx top' href='#$idx'>$idx</a></td>" >> $phtml |
echo "<li><a name='$idx' href='#$idx top'>$string</a><ul>" >> $tmp |
p=1 |
else |
echo $line | sed 's/@/<li><span style="color:blue;font-size:0.8em">/g' >> $tmp |
echo "</span></li>" >> $tmp |
p=2 |
alt=`echo "$line" | grep "@ alternative :" | awk '{ print $4 }' | tr -d '[:blank:]'` |
if [ ! -z $alt ] ; then |
if [ $cnt -gt $br ]; then |
echo "</tr><tr>" >> $phtml |
cnt=0 |
fi |
cnt=$(($cnt+1)) |
echo ",'$alt'" >> $keys |
echo "<td><a name='$alt top' href='#$idx'>$alt</a></td>" >> $phtml |
echo "<li><span style=\"color:blue;font-size:0.8em\">alternative command:<a name='$alt' href='#$alt top'>$alt</a></span></li>" >> $tmp |
else |
echo $line | sed 's/@/<li><span style="color:blue;font-size:0.8em">/g' >> $tmp |
echo "</span></li>" >> $tmp |
fi |
fi |
else |
# begin generating live examples signalled by @% |
name=`echo "$chk" | awk -F'%' '{ print $2 }' ` |
echo "command $name" |
cont=`echo "$chk" | tr '%' '\n'` |
echo "$cont" | sed '1,2d'> $tmpdir/$name.txt |
echo "$htmlhead" > $tmpdir/$name.html |
cat $tmpdir/$name.txt | ./canvasdraw | sed 's/src=\"wims.cgi?session=123*.*.js\"/src=\"'$name'.js\"/g' >> $tmpdir/$name.html |
echo "<li><span style=\"color:red;font-size:0.8em\">live example: <a href=\"$tmpdir/$name.html\" target=\"popup\" onclick=\"window.open('$idx','$name','width=400,height=400,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes,top=4,left=4,status=no)\">$name</a></span></li>" >> $tmp |
echo "<textarea cols='60' rows='10'>" >> $tmpdir/$name.html |
echo "$cont" | sed '1,2d' >> $tmpdir/$name.html |
echo "</textarea>" >> $tmpdir/$name.html |
echo "$htmltail" >> $tmpdir/$name.html |
mv -v $wims_tmp/*.js $tmpdir/$name.js |
fi |
else |
if [ $p -eq 2 ]; then |
143,3 → 172,5 |
rm $tmp |
rm $keys |
|
|
|