: # feed this into perl *-*-perl-*-* eval 'exec perl $0 "$@"' if $running_under_some_shell; # # chowto_scan.perl: # Scan though all of the Howto documents to produce various # automatically maintained files such as: # bibtex database of howto files # Web index of howto files # # howto_scan.pl # # $Log: chowto_scan.perl,v $ # Revision 1.9 2005/03/18 20:17:44 saw # Add support for experiment specific branches # # Revision 1.8 2003/06/19 18:29:41 saw # Multiline titles, links to other Hall C documentation # # Revision 1.7 2003/04/11 14:29:05 saw # Add Sos and Electronics to possible howto categories # # Revision 1.6 2003/04/04 14:28:38 saw # Prohibit off site access to vendor manuals # # Revision 1.5 2003/03/31 18:33:00 saw # Correct error in howtolist.text file. # # Revision 1.4 2003/03/19 21:28:22 saw # Uses working directory to find files. Looks in ../VendorManuals for a # BibTeX database to append to chowto-auto.bib. # # Revision 1.3 2003/03/11 21:54:36 saw # Generate the index.html file with this script # # Revision 1.2 2003/03/08 04:38:40 saw # Add links to postscript files on howtolist.html # # Revision 1.1 2003/03/06 20:21:57 saw # Initial Checkin # $URLBASE = $ARGV[0]; %cattab = ( "general","General", "daq","DAQ", "hms","HMS", "sos","SOS", "magnet", "Magnets", "beamline", "Beamline", "electronics", "Electronics" ); if(-s "EXPERIMENT") { chomp($EXPERIMENT=`head -1 EXPERIMENT`); } else { $EXPERIMENT="Hall C"; } open(BIBDB, ">chowto-auto.bib"); print BIBDB "% chowto-auto.bib\n"; print BIBDB "% This file is automatically generated, do not edit\n\n"; open(HTML, ">index.html"); open(TEXT, ">howtolist.text"); print HTML qq{ ${EXPERIMENT} Howto and Reference Documents

Table of ${EXPERIMENT} Howtos

The following is a table of ${EXPERIMENT} howtos and references. To sort the listing, click on column heading for the column that you would like to sort on. To contribute a howto or reference, please read the Howto Howto for instructions. To obtain the latest version of the template, bibliography database and style files, please download chowto.tgz. Mail any howtos that you write to Steve Wood who will post them to this listing.

Other Hall C Documentation:

  1. Cryogenic Target System
  2. Operating Procedures and Manuals
  3. Vendor Supplied Manuals

To read a howto online, click on the title for that howto. To download a postscript file suitable for printing, click on the appropriate link in the "PS" column.

}; print HTML qq{}; print TEXT "Filename|Category|Type|Author|Title|HTML|PS\n"; foreach $texfilename (glob("*.tex")) { open(TEXFILE,"<$texfilename"); ($barefilename) = $texfilename=~ /([^\/]+).tex$/; %info = {}; while() { chomp; if(/^\\howtotype{(.*)}/) { $info{howtotype} = $1; } elsif (/^\\author{(.*)}/) { $info{author} = $1; $info{author}=~s/\s*,\s*/ and /; } elsif (/^\\title{([^%]*)/) { # Allow multi line titles $line = $1; print "$line\n"; $info{title} = ''; while(not $line=~/}\s*(%.*)?$/) { $info{title} .= $line." "; print "$info{title}\n"; $line=; chomp($line); print "Newline = $line\n"; } $line =~ /^([^%]*)}\s*(%.*)?$/; $info{title} .= $1; $info{title}=~s/\\\\//g; print "$info{title}\n"; } elsif (/^\\category{(.*)}/) { $info{category} = $cattab{$1}; } elsif (/^\\maintainer{(.*)}/) { $info{maintainer} = $1; } elsif (/^\\date{(.*)}/) { $info{date} = $1; } } print BIBDB "\@Misc\{howto:$barefilename,\n"; print BIBDB " author = {$info{author}},\n"; print BIBDB " editor = {$info{maintainer}},\n" if ($info{maintainer}); print BIBDB " title = {$info{title}},\n"; if($info{howtotype} eq "user") { print BIBDB " note = {${EXPERIMENT} User Howto},\n"; } elsif($info{howtotype} eq "expert") { print BIBDB " note = {${EXPERIMENT} Expert Howto},\n"; } elsif($info{howtotype} eq "reference") { print BIBDB " note = {${EXPERIMENT} Reference},\n"; } print BIBDB " url = {$URLBASE/$barefilename/}\n}\n\n"; print "$barefilename\n"; $howtotypeuc = ucfirst($info{howtotype}); print HTML "\n"; print TEXT "$barefilename|$info{category}|$howtotypeuc|$info{author}|$info{title}|$URLBASE/$barefilename/|$URLBASE/$barefilename.ps\n"; close(TEXFILE); } print HTML "
FilenameCategoryTypeAuthorTitlePS
$barefilename$info{category}$howtotypeuc $info{author}$info{title} PS
\n"; @time = localtime; @months = qw(January February March April May June July August September October November December); $month = $months[$time[4]]; $day = $days[$time[6]]; $year = $time[5]+1900; print HTML "

Last modified $month $time[3], $year\n"; print HTML "\n"; close(BIBDB); $vendorbibfile = "../VendorManuals/VendorManuals.bib"; if(-r $vendorbibfile) { `cat $vendorbibfile >> chowto-auto.bib`; } close(HTML); close(TEXT);