diff options
| author | str4d <str4d@mail.i2p> | 2013-08-12 06:26:48 -0500 |
|---|---|---|
| committer | Nick Mathewson <nickm@torproject.org> | 2013-08-12 21:28:56 -0400 |
| commit | 0617a86ad09a502a9805d5b4073591bc1ad4a337 (patch) | |
| tree | e62e94e24c603738ab392e5aa0de48c4ed888aee /writeHTML.py | |
| parent | 07b87eb5a2001ac3e6a26c307432cf0810cfbd9f (diff) | |
| download | anonbib-0617a86ad09a502a9805d5b4073591bc1ad4a337.tar.gz | |
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 (limited to 'writeHTML.py')
| -rwxr-xr-x | writeHTML.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/writeHTML.py b/writeHTML.py index 19a7c14..2a3d455 100755 --- 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']) |
