bib2html: Sanitize bibentry sort without month
authorStefan Huber <shuber@sthu.org>
Fri, 11 Nov 2022 14:29:25 +0000 (15:29 +0100)
committerStefan Huber <shuber@sthu.org>
Fri, 11 Nov 2022 14:29:25 +0000 (15:29 +0100)
bib2html.py

index 64286f25ed25a3c513164c6481194e67f8280be2..72a57718d7ab96976e315531b5774b74d7d37dae 100755 (executable)
@@ -136,11 +136,16 @@ def entryDateSortKey(p):
             'apr' : '04', 'may' : '05', 'jun' : '06', \
             'jul' : '07', 'aug' : '08', 'sep' : '09', \
             'oct' : '10', 'nov' : '11', 'dec' : '12'}
+
+    if not 'month' in e.fields:
+        return e.fields['year']
+
     month = e.fields['month'].lower()[0:3]
     if month in month2num:
         month = month2num[month]
     else:
         month = ""
+
     return e.fields['year'] + "-" + month