commit 7a1eb1d2da6158ffa6a6125ca5eec8a7037b0cf1
parent b478fc493d4be2115185d94e077bf06196495417
Author: str4d <str4d@mail.i2p>
Date: Mon, 12 Aug 2013 06:26:48 -0500
Don't fail if one of the hardcoded negative indexes does not exist
This fixes the corner case where a tag set includes one year or less - the
list would not have an entry at index -2 (or -1 if no papers have the tag).
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/writeHTML.py b/writeHTML.py
@@ -162,10 +162,13 @@ def writePageSet(config, bib, tag):
entries = BibTeX.sortEntriesByDate(bib_entries)
entries = BibTeX.splitSortedEntriesBy(entries, 'year')
for idx in -1, -2:
- if entries[idx][0].startswith("<span class='bad'>"):
- entries[idx] = ("Unknown", entries[idx][1])
- elif entries[idx][0].startswith("forthcoming"):
- entries[idx] = ("Forthcoming", entries[idx][1])
+ try:
+ if entries[idx][0].startswith("<span class='bad'>"):
+ entries[idx] = ("Unknown", entries[idx][1])
+ elif entries[idx][0].startswith("forthcoming"):
+ entries[idx] = ("Forthcoming", entries[idx][1])
+ except IndexError:
+ continue
sections = [ ent[0] for ent in entries ]
first_year = int(entries[0][1][0]['year'])