#!/bin/tcsh -f # build a summary of the html files in each dir that have # been upgraded to CSS. set me=$0:t # the name of this program # Abort if the required env variables aren't set if (! ${?HTML_DIR}) then echo ${me}: HTML_DIR environment variable not set\! exit endif cd $HTML_DIR set theResult = $HTML_DIR/tech/css-progress.html set theTestTag = css/base.css # the string that IDs a file as done set tmpScript = /tmp/${me}.exec # the script file for find's 'exec' set tmpScriptOut = /tmp/${me}.out # output from the script set tmpTotal = /tmp/${me}.total #where the tally is kept set tmpTotalToDo = /tmp/${me}.todo #where the tally is kept set tmpTotalDone = /tmp/${me}.done #where the tally is kept echo "Preparing CSS Upgrade progress report for ${HTML_DIR}..." echo "0" > $tmpTotal #reset the tally to zero echo "0" > $tmpTotalToDo #reset the tally to zero echo "0" > $tmpTotalDone #reset the tally to zero ########################### #create the exec command file for 'find' cat << END_INPUT > $tmpScript #!/bin/tcsh -f cd \$1 set p = \`pwd | sed -e "s/^.*Sites\/ati/ati/" \` set n = \`ls *html | wc -l\` #count the html files set nOld = \`cat $tmpTotal\` expr \$nOld + \$n > $tmpTotal set nCSS = \`grep -l $theTestTag *html | wc -l\` #count the CSS-enabled files set nOld = \`cat $tmpTotalDone\` expr \$nOld + \$nCSS > $tmpTotalDone set nToDo = \`expr \$n - \$nCSS\` # how many remain if (\$nToDo > 0) then echo -n '' set nOld = \`cat $tmpTotalToDo\` expr \$nOld + \$nToDo > $tmpTotalToDo else echo -n '' endif echo -n "\${p}" echo -n '' echo -n "\$n" echo -n '' echo -n "\$nCSS" echo -n '' if (\$nToDo == 0) then echo -n '' else echo -n '' endif echo -n "\$nToDo" echo -n '' echo END_INPUT chmod +x $tmpScript #make it executable ########################### set theDate=`date "+$DATE_FORMAT_ATI_REV_DATE"` ############################ # Write the header cat << END_INPUT > $theResult CSS-conversion Progress Summary Help | Home » Technical Notes

CSS-conversion Progress Summary

$theDate

In early 2005 I decided to upgrade all of Access to Insight's 1,500+ pages to take advantage of Cascading Style Sheets (CSS), a technology that will eventually make the website easier to navigate, give its pages a more consistent and pleasing "look," and make it more accessible to our visually impaired visitors. To bring the pages into conformity with CSS requires that the HTML code in every page be edited by hand. It's a time-consuming process, but well worth the effort. This page shows how things are going.

END_INPUT ############################ # Now search through the driectories (excluding some), executing the script in each one find . \( -path \*/cgi -o -path \*/css -o -path \*/unsupported -o -path \*/icon -o -path \*/images -o -path \*/.FBCLockFolder \) -prune -o -type d -exec $tmpScript {} \; >> $tmpScriptOut # Edit the output to add hyperlinks to the listed directories ed << END_INPUT $tmpScriptOut %s/ati\([^<]*\)/ati\1\/<\/a>/ w Q END_INPUT ############################ # Write the summary data set nTotal = `cat $tmpTotal` set nDone = `cat $tmpTotalDone` set nToDo = `cat $tmpTotalToDo` set pctDone = `expr \( $nDone \* 100 \) / $nTotal` set pctToDo = `expr \( $nToDo \* 100 \) / $nTotal` cat << END_INPUT >> $theResult
Total files:$nTotal
Done:$nDone (${pctDone}%)
To Do:$nToDo (${pctToDo}%)

END_INPUT ############################ # write the dir-by-dir results cat $tmpScriptOut >> $theResult ############################ # write the footer cat << END_INPUT >> $theResult
DirectoryFilesDoneTo Do

Revised: Undated
http://www.accesstoinsight.org/tech/$theResult:t END_INPUT ############################ /bin/rm /tmp/${me}.* echo "done. Summary:" echo " Files: $nTotal" echo " Done: $nDone (${pctDone}%)" echo " To do: $nToDo (${pctToDo}%)" echo "Details in ${theResult}."