diff options
Diffstat (limited to 'perl-v2/mkpdospubs.pl')
| -rw-r--r-- | perl-v2/mkpdospubs.pl | 242 |
1 files changed, 242 insertions, 0 deletions
diff --git a/perl-v2/mkpdospubs.pl b/perl-v2/mkpdospubs.pl new file mode 100644 index 0000000..777386a --- /dev/null +++ b/perl-v2/mkpdospubs.pl @@ -0,0 +1,242 @@ +#!/usr/local/bin/perl -w +# *** +# *** CGI script: static PDOS publication list +# *** Eddie Kohler, June 10, 1999 +# *** +# *** Take a look at PDOSBib.pm +# *** to change things like people's URLs +# *** and how different bibliography entries are generated +# *** +# *** Take a look at PDOSCGI.pm +# *** to change where files are located +# *** + +#use lib '/home/am0/httpd/htdocs/pdosbib'; +use BibTeX; +use PDOSBib; +use PDOSCGI; + +sub do_entries () { + my($section, $key, $d); + foreach $section (@sections) { + # print section header + print '<h3><a name="', url_untranslate($section), '">'; + print $section, "</a></h3>\n"; + print "<ul class=\"expand\">\n"; + + # print all papers in that section + foreach $key (@{$e->{'_'}}) { + $d = BibTeX::expand($e, $key); + next if dont_print($d) || $d->{'www_section'} ne $section; + print htmlize_entry $d; + } + + print "</ul>\n"; + } +} + + +sub do_sections () { + foreach $section (@sections) { + print '<p class="l2"><a href="#', url_untranslate($section); + print '">', $section, "</a></p>\n"; + } +} + + +# main program +if (@ARGV > 0) { + open(BIB, $ARGV[0]) || die "can't open $ARGV[0]"; +} else { + open(BIB, "<&STDIN"); +} +$e = BibTeX::parse(*BIB, %initial_strings); +close BIB; + +if (@ARGV > 1) { + open(STDOUT, ">$ARGV[1]") || die "can't open $ARGV[1]"; +} + +# make sections +@sections = (); +foreach $key (@{$e->{'_'}}) { + next if dont_print($e->{$key}); + $section = $e->{$key}->{'www_section'}; + if (not $section) { + $e->{$key}->{'www_section'} = $section = "Miscellaneous"; + } + + if (!exists $sections{$section}) { + push @sections, $section if $section ne ''; + $sections{$section} = 1; + } +} +push @sections, 'Miscellaneous' + if $sections{''} && !$sections{'Miscellaneous'}; + +## PRINT STUFF! +$argv_string = join(' ', 'mkpdospubs.pl', @ARGV); +print <<"EOD;"; +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html><head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<meta http-equiv="Content-Style-Type" content="text/css"> + +<!-- *** I AM MACHINE GENERATED! DO NOT EDIT ME! + -- *** EDIT THE .bib FILE INSTEAD! + -- + -- Generated by `$argv_string' + -- (c) Eddie Kohler 1999-2000 --> + +<title>Anonymity Bibliography</title> + +<link rel="stylesheet" type="text/css" href="main.css"> +<link rel="stylesheet" type="text/css" href="pubs.css"> + +</head> +<body bgcolor="#ffffff" text="#000000" link="#bb0000" vlink="#990099" +alink="#ff9900" marginheight="0" marginwidth="0"> + +<table cellspacing="0" cellpadding="0" border="0" align="center"> + +<!-- +<tr valign="top"> +<td rowspan="5" width="134"><div align="right"><a href="/"><img +src="/img/pdostab.gif" width="134" height="61" border="0" +alt="PDOS Home"></a></div></td> +<td rowspan="5" width="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> +<td bgcolor="#ffffcc"><p><br></p></td> +<td bgcolor="#ffffcc"><p><br></p></td> +<td bgcolor="#ffffcc"><p><br></p></td> +<td rowspan="3" width="8" bgcolor="#ffffcc"><img src="/img/emptydot.gif" +width="8" height="1" alt=""></td> +<td rowspan="3" width="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> +</tr> + +<tr valign="top"> +<td bgcolor="#ffffcc"><p> <a href="http://web.mit.edu/">MIT</a> > <a href="http://www.lcs.mit.edu/">LCS</a> > <a href="/">PDOS Home</a> > </p></td> +<td bgcolor="#ffffcc"><p><b>Publications</b> > </p></td> +<td bgcolor="#ffffcc"><p><b>By subject</b></p></td> +</tr> + +<tr valign="top"> +<td bgcolor="#ffffcc"><p><br></p></td> +<td bgcolor="#ffffcc"><p class="crumbbreadth"> +<a href="projects.html">Projects</a><br> +<a href="people.html">People</a><br> +<a href="software.html">Software</a></p></td> +<td bgcolor="#ffffcc"><p class="crumbbreadth"> +<a href="/cgi-bin/pubs-date.cgi">By date</a></p></td> +</tr> + +<tr valign="top"> +<td colspan="2" height="8" bgcolor="#ffffcc"><img src="/img/emptydot.gif" +width="1" height="8" alt=""></td> +<td colspan="1" height="8" bgcolor="#ffffcc"><img src="/img/emptydot.gif" +width="100" height="8" alt=""></td> +<td colspan="2" rowspan="2" width="9" height="9" bgcolor="#ffffcc"><img +src="/img/whitecorner.gif" width="9" height="9" alt=""></td> +</tr> + +<tr valign="top"> +<td colspan="3" height="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> +</tr> + +</table> +--> + +<h1 align="center">Anonymity bibliography</h1> +<p align="center">By subject | <a href="/cgi-bin/pubs-date.cgi">By date</a></p> + +<table cellspacing="0" cellpadding="0" border="0" width="100%"> + +<tr valign="top"> +<td width="10%" height="24"><br></td> +</tr> + +<tr valign="top"> +<td><div align="right"> +<table cellspacing="0" cellpadding="0" border="0" width="161"> + +<tr valign="top"> +<td rowspan="6" width="8"><img src="/img/emptydot.gif" +width="8" height="1" alt=""></td> +<td colspan="4" height="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> +</tr> + +<tr valign="top"> +<td rowspan="5" width="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> + +<td bgcolor="#ccffff"><p class="l1"><br><form action="/cgi-bin/pubs-date.cgi" +method="get"><strong>Publication search:</strong><br> +<small><input type=entry name=match size=15> <input type=submit +value="Go"><br></small></form></p></td> + +<td width="8" bgcolor="#ccffff"><img src="/img/emptydot.gif" +width="8" height="1" alt=""></td> +<td rowspan="3" width="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> +<td rowspan="3" width="12"><img src="/img/emptydot.gif" +width="12" height="1" alt=""></td> +</tr> + +<tr valign="top"> +<td colspan="2" height="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> +</tr> + +<tr valign="top"> +<td bgcolor="#ccffff"><p class="l1"><br><form action="/cgi-bin/pubs-date.cgi" +method="get"><strong>Subjects:</strong><br> +EOD; + +## PRINT SECTIONS +do_sections; + +print <<"EOD;"; +</p></td> + +<td width="8" bgcolor="#ccffff"><img src="/img/emptydot.gif" +width="8" height="1" alt=""></td> +</tr> + +<tr valign="top"> +<td height="8" bgcolor="#ccffff"><img src="/img/emptydot.gif" +width="1" height="8" alt=""></td> +<td colspan="2" rowspan="2" width="9" height="9" bgcolor="#ccffff"><img +src="/img/whitecorner.gif" width="9" height="9" alt=""></td> +</tr> + +<tr valign="top"> +<td height="1" bgcolor="#92a6a4"><img src="/img/emptydot.gif" +width="1" height="1" alt=""></td> +</tr> + +</table> +</div></td> + +<td width="75%"> + +<h2>Publications by subject</h2> + +EOD; + +## PRINT ENTRIES +do_entries; + +print <<"EOD;"; +</td> + +<td width="15%"><br></td> + +</tr> +</table> + +</body> +</html> +EOD; |
