#!/bin/sh # $Id: updateDemos 68993 2014-04-23 01:42:51Z cxh $ # Script that updates the demos demos=`cd $PTII/ptolemy/configs/doc; make --no-print-directory listDemos | egrep -v '(iRobotCreateVerification|Matlab|SystemLevelType)' ` # Create missing applets #demos=`cd $PTII/ptolemy/configs/doc; make check_applets | grep -v /SystemLevelType/ | sed 's/.htm$/.xml/'` #demos=../../../ptolemy/domains/ddf/demo/IfThenElse/IfThenElseFSM.xml for demo in $demos do model=`basename $demo .xml` modelDirectory=`dirname $demo` modelPath=`cd $PTII/ptolemy/configs/doc/$modelDirectory; pwd` targetPath=`echo $modelPath | sed "s@$PTII/@@"` echo "make MODEL=$model MODELPATH=$modelPath/$model.xml TARGETPATH=$targetPath jnlpUpdateDemo" #echo $modelPath/$model.htm # We just echo the make file commands continue #rm $modelPath/$model.htm #svn update $modelPath/$model.htm htmlFile=$modelPath/$model.htm # appletFile=$modelPath/${model}Vergil.htm # if [ -f $appletFile ]; then # echo $appletFile # grep "CONVERTER -->" $appletFile # status=$? # if [ $status -eq 0 ]; then # sed -e 's/width = ".*"/width = "100"/' \ # -e's/height = ".*"/height = "100"/' < $appletFile > /tmp/updateDemos.tmp # diff /tmp/updateDemos.tmp $appletFile # cp /tmp/updateDemos.tmp $appletFile # echo "$htmlFile" >> /tmp/hfiles # fi # fi # if [ -f $htmlFile ]; then # echo $htmlFile # grep -vi 'center>' \ # $htmlFile > /tmp/updateDemos.tmp # diff /tmp/updateDemos.tmp $htmlFile # cp /tmp/updateDemos.tmp $htmlFile # echo "$htmlFile" >> /tmp/hfiles # fi if [ -f $htmlFile ]; then echo $htmlFile sed -e 's/is available in two formats:/is available as:/' \ -e 's/
  • As an/
  • An/' \ -e 's/The Java Web Start version is preferred, though browsers with versions of Java/@' \ $htmlFile | grep -v '
  • As a Web Start Application:' \ > /tmp/updateDemos.tmp diff /tmp/updateDemos.tmp $htmlFile cp /tmp/updateDemos.tmp $htmlFile echo "$htmlFile" >> /tmp/hfiles fi continue #if [ -f $modelPath/$model.htm ]; then # rm $modelPath/$model.htm # svn update $modelPath/$model.htm # sed -e "s@ptinyViewer [^>]*>@ptinyViewer $targetPath/$model.xml\">@" \ # -e "s@fullViewer [^>]*>@fullViewer $targetPath/$model.xml\">@" \ # $modelPath/$model.htm > /tmp/$model.htm if [ -f $modelPath/$model.htm -a -f $modelPath/${model}JNLP.htm ]; then svnStatus=`svn status $modelPath/$model.htm | awk '{print $1}'` if [ "$svnStatus" == "M" ]; then rm $modelPath/$model.htm svn update $modelPath/$model.htm fi awk -v jnlpFile=$model.jnlp '{ if ($0 ~ //) { sawHTMLConverter = 1 print ""; print "Run the demo using Web Start"; } else if ($0 ~ //) { sawHTMLConverter = 0 print ""; } else if (sawHTMLConverter == 0) { print $0 } }' $modelPath/$model.htm > /tmp/${model}0.htm awk '{ if ($0 ~ //) { exit; } if ($0 ~ /section is for IE/) { endOfComment=NR } if ($0 ~ /http:\/\/developer.java.sun.com\/developer\/bugParade\/bugs\/4713003.html/) { endOfComment=NR } if ($0 !~ /CENTER>/ && $0 !~ /center>/ $0 !~ /The HTML below is for/ && $0 !~ /section is for IE/ && !($0 == " -->" && NR == (endOfComment+1))) { print $0 } }' /tmp/${model}0.htm | grep -v "@author:" | grep -v "model shown using Vergil, the Ptolemy II schematic editor:" | grep -v "For information about applets and Ptolemy, see" | grep -v "http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/doc/coding/applets.htm" | grep -v "For information about java versions and applet tags, see:" | grep -v "http://java.sun.com/products/plugin/versions.html" | grep -v "We are currently using 1.4.2 because:" | grep -v "There is a bug under JDK1.4.1 XP with Radeon display cards" | grep -v "that causes XP to hang when exiting. For details, see" | grep -v "http://developer.java.sun.com/developer/bugParade/bugs/4713003.html" \ > /tmp/$model.htm awk '{if ($0 ~ //) { sawJNLPAppletConverter = 1 } if (sawJNLPAppletConverter == 1) { print $0 } if ($0 ~ //) { exit } }' $modelPath/${model}JNLP.htm | sed "s/url, '1.6.0'/url/" >> /tmp/$model.htm awk '{ if (sawJNLPConverter == 1) { if ($0 !~ /CENTER>/) { print $0 } } if ($0 ~ // || $0 ~ // || $0 ~ //) { sawJNLPConverter = 1; } }' $modelPath/$model.htm >> /tmp/$model.htm diff /tmp/$model.htm $modelPath/$model.htm #cp /tmp/$model.htm $modelPath/$model.htm # ls -l /tmp/$model.htm $modelPath/$model.htm # echo $modelPath/$model.htm fi done