gnunetbib

Bibliography (BibTeX, based on AnonBib)
Log | Files | Refs | README | LICENSE

commit 714fc86c1c497125d7f28d56b1cd88cc592f7b32
parent 0b3e9397a810e0b62dd2ab71bcabe185b43fd90e
Author: Nick Mathewson <nickm@torproject.org>
Date:   Wed,  6 Apr 2011 20:08:19 +0000

Add new code to handle month ranges and funky page ranges

svn:r358

Diffstat:
MBibTeX.py | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/BibTeX.py b/BibTeX.py @@ -247,7 +247,12 @@ def sortEntriesByDate(entries): tmp.append((20000*13, i, ent)) continue try: - mon = MONTHS.index(ent.get("month")) + monthname = ent.get("month") + if monthname is not None: + match = re.match(r"(\w+)--\w+", monthname) + if match: + monthname = match.group(1) + mon = MONTHS.index(monthname) except ValueError: print "Unknown month %r in %s"%(ent.get("month"), ent.key) mon = 0 @@ -387,7 +392,7 @@ class BibTeXEntry: not self['booktitle'].startswith("{Proceedings of"): errs.append("ERROR: %s's booktitle (%r) doesn't start with 'Proceedings of'" % (self.key, self['booktitle'])) - if self.has_key("pages") and not re.match(r'\d+--\d+', self['pages']): + if self.has_key("pages") and not re.search(r'\d+--\d+', self['pages']): errs.append("ERROR: Misformed pages in %s"%self.key) if self.type == 'proceedings': @@ -401,7 +406,7 @@ class BibTeXEntry: if field.startswith("www_") and field not in WWW_FIELDS: errs.append("ERROR: unknown www field %s"% field) if value.strip()[-1:] == '.' and \ - field not in ("notes", "www_remarks"): + field not in ("notes", "www_remarks", "author"): errs.append("ERROR: %s.%s has an extraneous period"%(self.key, field)) return errs