Return to vendormanual_scan.pl CVS log | Up to [HallC] / Documents / VendorManuals |
File: [HallC] / Documents / VendorManuals / vendormanual_scan.pl
(download)
/
(as text)
Revision: 1.2, Wed Mar 8 17:34:28 2006 UTC (18 years, 6 months ago) by saw Branch: MAIN CVS Tags: HEAD Changes since 1.1: +20 -7 lines Bring back changes from HKS branch |
: # feed this into perl *-*-perl-*-* eval 'exec perl $0 "$@"' if $running_under_some_shell; # # vendormanual_scan.perl: # # $Log: vendormanual_scan.pl,v $ # Revision 1.2 2006/03/08 17:34:28 saw # Bring back changes from HKS branch # # Revision 1.1.2.1 2006/03/08 17:11:13 saw # Allow for experiment dependent branches # # Revision 1.1 2003/03/19 21:18:32 saw # Makes BibTeX file from individual .bib files and builds HTML index of # the Vendor Manuals # $URLBASE = $ARGV[0]; if(-s "EXPERIMENT") { chomp($EXPERIMENT=`head -1 EXPERIMENT`); } else { $EXPERIMENT="Hall C"; } open(BIBDB, ">VendorManuals.bib"); print BIBDB "% VendorManuals.bib\n"; print BIBDB "% This file is automatically generated, do not edit\n\n"; open(INDEX, ">index.html"); print INDEX qq{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <title>${EXPERIMENT} Vendor Supplied Manuals</title> </head> <body> <h1>${EXPERIMENT} Vendor Supplied Manuals</h1> This page is an archive of manuals for various equipment that may be used in ${EXPERIMENT}. The manuals are in the format as supplied to us, typically Acrobat (.pdf), Postscript (.ps), or Word (.doc). <p> Writers of <a href="../howtos">${EXPERIMENT} howto and reference documents</a> may cite a manual from this list with the LaTeX command <tt>\\cite{</tt><i>key</i><tt>}</tt>, where <i>key</i> is the BibTeX key in the list below. <p> Out of respect for copyrights, this archive of manuals is only accessble from JLab computers. <p> Please send any manuals that belong in this archive to <a href="mailto:saw@jlab.org">Steve Wood</a>. <p> <table border cellpadding=3 cellspacing=0> }; print INDEX "<tr><th>BibTeX Key</th><th>Title</th><th>Format</th></tr>\n"; for $manualfilename (glob("*.{ps,pdf,doc}")) { # print "$manualfilename\n"; ($filenamenosuffix,$format) = $manualfilename=~/^(.*)\.(.*)/; # print "$filenamenosuffix\n"; ($barefilename) = $manualfilename=~/([^\/]*)$/; # print "$barefilename\n"; ($reallybarefilename) = $filenamenosuffix=~/([^\/]*)$/; if(not open(BIBIN,"<$filenamenosuffix.bib")) { print "$filenamenosuffix.bib not found\n"; $bibtexkey = $reallybarefilename; print BIBDB "\@Misc\{$bibtexkey,\n"; print BIBDB " url={$URLBASE/$barefilename}\n"; print BIBDB "}\n"; } else { undef($title); undef($incompletetitle); while(<BIBIN>) { chomp; print BIBDB "$_\n" if(/^\s*[^%]/); # Strip comments if($incompletetitle) { $partialtitle = $title." ".$_; if($partialtitle =~ /^(.*)},/) { $title = $1; undef($incompletetitle); } else { $title = $partialtitle; } } elsif (/^@.*\{\s*(.*)\s*,/) { $bibtexkey = $1; print BIBDB " url={$URLBASE/$barefilename},\n"; } elsif (/title\s*=\s*\{(.*)$/) { $partialtitle = $1; if($partialtitle =~ /^(.*)\},/) { $title = $1; } else { $title = $partialtitle; $incompletetitle = 1; } } } $title = "Title Missing" if(not $title); close(BIBIN); } print INDEX "<tr><td>$bibtexkey</td> <td><a href=\"$URLBASE/$barefilename\">$title</a><td>$format</td></tr>\n"; } print INDEX "</table></body></html>\n"; close(INDEX); close(BIBDB);
Analyzer/Replay: Mark Jones, Documents: Stephen Wood |
Powered by ViewCVS 0.9.2-cvsgraph-1.4.0 |