commit b5d9c94192baeb629176e119a1d01b9c64576232
parent a8cc83deaa74387d58364eca1736a0594f43f113
Author: Nick Mathewson <nickm@torproject.org>
Date: Sat, 17 May 2003 07:44:15 +0000
Work on HTML generation
svn:r8
Diffstat:
7 files changed, 304 insertions(+), 38 deletions(-)
diff --git a/.cvsignore b/.cvsignore
@@ -0,0 +1,2 @@
+*.pyc
+*.pyo
diff --git a/BibTeX.py b/BibTeX.py
@@ -4,21 +4,13 @@ import cStringIO
import re
import sys
+import config
+
__all__ = ( 'ParseError', 'BibTeX', 'BibTeXEntry', 'htmlize',
'ParsedAuthor', 'FileIter', 'Parser', 'parseFile',
'splitBibTeXEntriesBy',
'sortBibTexEntriesBy', )
-
-INITIAL_STRINGS = {
- 'jan' : 'January', 'feb' : 'February',
- 'mar' : 'March', 'apr' : 'April',
- 'may' : 'May', 'jun' : 'June',
- 'jul' : 'July', 'aug' : 'August',
- 'sep' : 'September', 'oct' : 'October',
- 'nov' : 'November', 'dec' : 'December'
- }
-
class ParseError(Exception):
pass
@@ -50,8 +42,15 @@ class BibTeX:
del ent.entries['crossref']
ent.entries.update(cr.entries)
ent.resolve()
+ newEntries = []
+ for ent in self.entries:
+ if ent.type in config.OMIT_ENTRIES:
+ del self.byKey[ent.key]
+ else:
+ newEntries.append(ent)
+ self.entries = newEntries
-def splitBibTeXEntriesBy(entries, field):
+def splitEntriesBy(entries, field):
result = {}
for ent in entries:
key = ent.get(field)
@@ -61,8 +60,8 @@ def splitBibTeXEntriesBy(entries, field):
result[key] = [ent]
return result
-def sortBibTeXEntriesBy(self, field):
- tmp = [ ent.get(field), ent for ent in entries ]
+def sortEntriesBy(self, field):
+ tmp = [ (ent.get(field), ent) for ent in entries ]
tmp.sort()
return [ t[2] for t in tmp ]
@@ -81,6 +80,8 @@ class BibTeXEntry:
return self.entries.get(k,v)
def __getitem__(self, k):
return self._get(k)
+ def __setitem__(self, k, v):
+ self.entries[k] = v
def __str__(self):
return self.format(70,1)
def format(self, width=70,v=0):
@@ -111,12 +112,10 @@ class BibTeXEntry:
self.parsedAuthor = None
def check(self):
ok = 1
- if self.type in ('proceedings', 'journal'):
- return 1
- elif self.type == 'inproceedings':
- fields = 'booktitle', 'month', 'year'
+ if self.type == 'inproceedings':
+ fields = 'booktitle', 'year'
elif self.type == 'article':
- fields = 'journal', 'month', 'year'
+ fields = 'journal', 'year'
elif self.type == 'techreport':
fields = 'institution', 'number'
elif self.type == 'misc':
@@ -128,7 +127,7 @@ class BibTeXEntry:
for field in fields:
if not self.get(field):
print "ERROR: %s has no %s field" % (self.key, field)
- self.entries[field] = "<b>???</b>"
+ self.entries[field] = "<span class='bad'>%s:??</span>"%field
ok = 0
return ok
@@ -153,7 +152,7 @@ class BibTeXEntry:
if self.get("address"):
res.append(",")
res.append(self['address'])
- res.append(", %s %s" % (self['month'], self['year']))
+ res.append(", %s %s" % (self.get('month',""), self['year']))
if not self.get('pages'):
pass
elif "-" in self['pages']:
@@ -171,7 +170,7 @@ class BibTeXEntry:
res.append(" <b>%s</b>"%self['volume'])
if self.get('number'):
res.append("(%s)"%self['number'])
- res.append(", %s %s" % (self['month'], self['year']))
+ res.append(", %s %s" % (self.get('month',""), self['year']))
if not self.get('pages'):
pass
elif "-" in self['pages']:
@@ -212,10 +211,11 @@ class BibTeXEntry:
res = ["<Odd type %s>"%self.type]
res[0:0] = ["<span class='biblio'>"]
- res.append("</span ")
+ res.append("</span>")
- res.append("<span class='availability'>"
- "(<a href='__'>BibTex  entry<a>)")
+ res.append(" <span class='availability'>"
+ "(<a href='__'>BibTeX entry</a>)"
+ "</span>")
return htmlize("".join(res))
def to_html(self):
@@ -226,15 +226,16 @@ class BibTeXEntry:
('www_html_url', 'HTML'),
('www_pdf_url', 'PDF'),
('www_ps_url', 'PS'),
+ ('www_txt_url', 'TXT'),
('www_ps_gz_url', 'gzipped PS')):
- url = self.get('key')
+ url = self.get(key)
if not url: continue
availability.append('<a href="%s">%s</a>' %(url,name))
if availability:
res.append(" <span class='availability'>(")
res.append(", ".join(availability))
- res.append("</span")
- res.append("<br>")
+ res.append(")</span>")
+ res.append("<br><span class='author'>by ")
#res.append("\n<!-- %r -->\n" % self.parsedAuthor)
htmlAuthors = []
@@ -243,7 +244,15 @@ class BibTeXEntry:
a = " ".join(f+v+l)
if j:
a = "%s, %s" %(a,j)
- htmlAuthors.append(htmlize(a))
+ a = htmlize(a)
+ htmlAuthor = None
+ for pat, url in config.AUTHOR_RE_LIST:
+ if pat.search(a):
+ htmlAuthor = '<a href="%s">%s</a>' % (url, a)
+ break
+ if not htmlAuthor:
+ htmlAuthor = a
+ htmlAuthors.append(htmlAuthor)
if len(htmlAuthors) == 1:
res.append(htmlAuthors[0])
elif len(htmlAuthors) == 2:
@@ -426,7 +435,7 @@ def split_von(f,v,l,x):
class Parser:
def __init__(self, fileiter, initial_strings):
- self.strings = INITIAL_STRINGS.copy()
+ self.strings = config.INITIAL_STRINGS.copy()
self.strings.update(initial_strings)
self.fileiter = fileiter
self.entries = {}
@@ -650,8 +659,7 @@ def parseFile(filename):
r.resolve()
for e in r.entries:
e.check()
- return r
-
+ return r
if __name__ == '__main__':
import sys
diff --git a/_template_.html b/_template_.html
@@ -0,0 +1,159 @@
+<!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 `%(command_line)s'
+ -- (c) Eddie Kohler 1999-2000, Nick Mathewson 2003 -->
+
+<title>Anonymity Bibliography</title>
+
+<link rel="stylesheet" type="text/css" href="./css/main.css">
+<link rel="stylesheet" type="text/css" href="./css/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>
+%(choices)s
+<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>
+
+%(sections)s
+
+</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 %(field)s</h2>
+
+<ul>
+%(entries)s
+</ul>
+
+</td>
+
+<td width="15%"><br></td>
+
+</tr>
+</table>
+
+</body>
+</html>
+
diff --git a/anonbib.bib b/anonbib.bib
@@ -7,6 +7,15 @@
@string{pub = "Anonymous publication"}
@string{nym = "Pseudonymity"}
+%% Journals and proceedings: used by reference
+
+@Proceedings{eurocrypt-02,
+ booktitle = "Proceedings of Eurocrypt 2002",
+ month = may
+ year = {2002},
+ bookurl = {http://www.ec2002.tue.nl/},
+}
+
%% Section: Mix Networks: Design
@Article{chaum-mix,
@@ -22,14 +31,15 @@
}
@Misc{mixminion-spec,
- author = {Mixminion},
- title = {Type {III} ({M}ixminion) Mix Protocol Specifications},
+ author = {George Danezis and Roger Dingledine and Nick Mathewson},
+ title = {Type {III} ({M}ixminion) Mix Protocol Specification},
+ howpublished = {},
www_section = mix,
www_txt_url = "http://mixminion.net/minion-spec.txt",
}
@InProceedings{BM:mixencrypt,
- author = {M{\"o}ller, Bodo},
+ author = {Bodo M{\"o}ller},
title = {Provably Secure Public-Key Encryption for Length-Preserving Chaumian Mixes},
booktitle = {{CT-RSA} 2003},
publisher = {Springer-Verlag, LNCS 2612},
@@ -192,7 +202,7 @@
author = {Lance Cottrell},
title = {Mixmaster and Remailer Attacks},
www_section = mixattacks,
- www_html_url = http://www.obscura.com/~loki/remailer/remailer-essay.html,
+ www_html_url = {http://www.obscura.com/~loki/remailer/remailer-essay.html},
}
@InProceedings{mitkuro,
@@ -220,12 +230,15 @@
www_ps_gz_url = "ftp://cag.lcs.mit.edu/pub/dm/papers/mazieres:pnym.pdf",
}
-@Misc{freedom-nyms,
+@techreport{freedom-nyms,
author = {Russell Samuels},
title = {Untraceable Nym Creation on the {F}reedom {N}etwork},
year = {1999},
month = {November},
day = {21},
+ type = {White Paper}
+ institution = {Zero-Knowledge}
+ number = {11}
www_section = nym,
www_html_url = "http://www.freedom.net/products/whitepapers/white11.html",
}
@@ -491,7 +504,10 @@
@misc{helsingius,
author = {J. Helsingius},
- title = {{\tt anon.penet.fi} press release},
+ title = {Johan Helsingius closes his Internet remailer}
+ howpublished = {Press Release},
+ month = aug,
+ year = {1996},
www_html_url = "http://www.penet.fi/press-english.html",
}
diff --git a/config.py b/config.py
@@ -0,0 +1,42 @@
+
+import re
+
+AUTHOR_URLS = {
+ 'Berthold' : 'http://page.inf.fu-berlin.de/~berthold/',
+ 'Miguel.*Castro' : 'http://research.microsoft.com/users/mcastro/',
+ 'Chaum' : 'http://www.chaum.org',
+ 'Danezis' : 'http://www.cl.cam.ac.uk/~gd216/',
+ 'Dingledine' : 'http://www.freehaven.net/~arma/cv.html',
+ 'Desmedt' : 'http://www.cs.fsu.edu/~desmedt/',
+ 'Jakobsson' : 'http://www.cs.ucsd.edu/users/markus/',
+ 'K.*Kurosawa' : 'http://kuro.cis.ibaraki.ac.jp/~kurosawa/',
+ 'B.*Liskov' : 'http://www.pmg.lcs.mit.edu/barbara_liskov.html',
+ 'Mathewson' : 'http://www.wangafu.net/~nickm/',
+ 'Mazières' : 'http://www.scs.cs.nyu.edu/~dm/',
+ 'A.*Pfitzmann' : 'http://dud.inf.tu-dresden.de/~pfitza/',
+ 'B.*Pfitzmann' : 'http://www.zurich.ibm.com/~bpf/',
+ 'Rivest' : 'http://theory.lcs.mit.edu/~rivest/',
+ 'Serjantov' : 'http://www.cl.cam.ac.uk/users/aas23/',
+ 'Syverson' : 'http://www.syverson.org/',
+ 'David.*Wagner' : 'http://www.cs.berkeley.edu/~daw/',
+ 'Shoup' : 'http://www.shoup.net/',
+ 'B.*Möller' : 'http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html',
+
+ }
+
+INITIAL_STRINGS = {
+ 'jan' : 'January', 'feb' : 'February',
+ 'mar' : 'March', 'apr' : 'April',
+ 'may' : 'May', 'jun' : 'June',
+ 'jul' : 'July', 'aug' : 'August',
+ 'sep' : 'September', 'oct' : 'October',
+ 'nov' : 'November', 'dec' : 'December'
+ }
+
+OMIT_ENTRIES = ("proceedings", "journal")
+
+### Don't edit below this line
+
+AUTHOR_RE_LIST = [
+ (re.compile(k, re.I), v,) for k, v in AUTHOR_URLS.iteritems()
+ ]
diff --git a/css/pubs.css b/css/pubs.css
@@ -27,6 +27,11 @@ SPAN.biblio A {
text-decoration: underline;
}
+SPAN.bad {
+ text-decoration: underline;
+ background-color: #FDF;
+}
+
P.l1 {
margin-left: 0.5em;
}
diff --git a/writeHTML.py b/writeHTML.py
@@ -1,6 +1,40 @@
#!/usr/bin/python
-import BiBTeX
+import BibTeX
+import config
+bib = BibTeX.parseFile("anonbib.bib")
+f = open("_template_.html")
+template = f.read()
+f.close()
+
+f = open("z.html", 'w')
+
+template_s, template_e = template.split("%(entries)s")
+
+print >>f, template_s
+
+entries = BibTeX.splitEntriesBy(bib.entries, "www_section")
+sections = entries.keys()
+sections.sort()
+if entries.has_key(None):
+ for ent in entries[None]:
+ ent['www_section'] = "Miscellaneous"
+
+ entries["Miscellaneous"] = entries[None]
+ del entries[None]
+ sections.append("Miscellaneous")
+ sections = filter(None, sections)
+
+for s in sections:
+ #XXX print '<h3><a name="', url_untranslate($section), '">';
+ print >>f, '<h3>%s</h3>'%s
+ print >>f, "<ul class='expand'>"
+ for e in entries[s]:
+ print >>f, e.to_html()
+ print >>f, "</ul>"
+
+
+print >>f, template_e