bib2html.py: Add [url] to entries
[shutils.git] / bib2html.py
index 72a57718d7ab96976e315531b5774b74d7d37dae..dee284ec3a1a51239ab019801bed5e9bd772ab90 100755 (executable)
@@ -37,7 +37,7 @@ import os, sys, getopt, re
 def format_latex(text):
     # Get rid of matching dollar signs
     text = re.sub(r'\$([^\$]*)\$', r'\1', text)
-    return text.replace('\mathcal', '').replace('{', '').replace('}', '').replace('\\', '')
+    return text.replace('\mathcal', '').replace('{', '').replace('}', '').replace('\\', '').replace('~', ' ').replace('--', '–')
 
 def format_field_span(type, value):
     return "<span class=bibentry_" + type + ">" + format_latex(value) + "</span>"
@@ -65,8 +65,9 @@ def format_details_article(entry):
             format_field(entry, 'number', pre='(', post=')'))
     line.append(format_field(entry, 'month', post=' ') + \
             format_field(entry, 'year'))
-    line = filter(lambda l: l != "", line)
+    line.append(format_field(entry, 'note'))
 
+    line = filter(lambda l: l != "", line)
     return [where, ", ".join(line)]
 
 def format_details_inproceedings(entry):
@@ -77,6 +78,9 @@ def format_details_inproceedings(entry):
     line.append(format_field(entry, 'address'))
     line.append(format_field(entry, 'month', post=' ') + \
             format_field(entry, 'year'))
+    line.append(format_field(entry, 'isbn', pre='ISBN '))
+    line.append(format_field(entry, 'note'))
+
     line = filter(lambda l: l != "", line)
     return [where, ", ".join(line)]
 
@@ -85,6 +89,8 @@ def format_details_thesis(entry):
     line.append(format_field(entry, 'school'))
     line.append(format_field(entry, 'month', post=' ') + \
             format_field(entry, 'year'))
+    line.append(format_field(entry, 'note'))
+
     line = filter(lambda l: l != "", line)
     return [", ".join(line)]
 
@@ -94,6 +100,8 @@ def format_details_book(entry):
     line.append(format_field(entry, 'isbn', pre='ISBN '))
     line.append(format_field(entry, 'month', post=' ') + \
             format_field(entry, 'year'))
+    line.append(format_field(entry, 'note'))
+
     line = filter(lambda l: l != "", line)
     return [", ".join(line)]
 
@@ -101,10 +109,11 @@ def format_links(entry):
     doi = format_field(entry, 'doi', pre='<a href="http://dx.doi.org/', post='">[DOI]</a>')
     webpdf = format_field(entry, 'webpdf', pre='<a href="', post='">[PDF]</a>')
     weblink = format_field(entry, 'weblink', pre='<a href="', post='">[link]</a>')
+    url = format_field(entry, 'url', pre='<a href="', post='">[url]</a>')
     webslides = format_field(entry, 'webslides', pre='<a href="', post='">[slides]</a>')
     weberrata = format_field(entry, 'weberrata', pre='<a href="',
             post='">[errata]</a>')
-    return " ".join([doi, webpdf, weblink, webslides, weberrata])
+    return " ".join([doi, webpdf, weblink, url, webslides, weberrata])
 
 def format_entry(entry):
     lines = []