The built in unsrt style depends on there being a year field (as opposed to a date field)

Issue #128 new
Arvid Norlander created an issue

The unsrt style depends on the year key being available, which means it fails to handle BibTeX files using the date key instead for a combined date (as happens in for example the BibTeX files exported by Zotero). The resulting behaviour is an exception being thrown.

Example code triggering this:

import pybtex.database
from pybtex.style.formatting.unsrt import Style as UnsrtStyle

db = pybtex.database.parse_string(""" 
@book{thrunProbabilisticRobotics2005, 
  langid = {english}, 
  location = {{Cambridge, Mass}}, 
  title = {Probabilistic Robotics}, 
  isbn = {978-0-262-20162-9}, 
  pagetotal = {647}, 
  series = {Intelligent Robotics and Autonomous Agents}, 
  publisher = {{MIT Press}}, 
  date = {2005}, 
  keywords = {Probabilities,Robotics}, 
  author = {Thrun, Sebastian and Burgard, Wolfram and Fox, Dieter}, 
}""", "bibtex")

style = UnsrtStyle()
style.format_entry("thrun", db.entries['thrunProbabilisticRobotics2005'])

Note that I also see dates formatted as "2017-05" and "2018-09-23" in my full bibtex file.

Ideally there should be some sort of helper functionality shared between different styles to extract dates from bibtex entries, regardless if they are given as year fields, date fields or something else.

Comments (0)

  1. Log in to comment