From: Stefan Huber Date: Fri, 11 Nov 2022 14:29:25 +0000 (+0100) Subject: bib2html: Sanitize bibentry sort without month X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=9ff084ff106b955d5dcc9ceb3b31ba4c1f0d46c5;p=shutils.git bib2html: Sanitize bibentry sort without month --- diff --git a/bib2html.py b/bib2html.py index 64286f2..72a5771 100755 --- a/bib2html.py +++ b/bib2html.py @@ -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