Skip to content

duplicates in display_order create duplicate entries #252

Description

@jakob-kellner

bibtexparser 1.1.0.

Not a big problem, but confused me for a while:

If the list assigned to writer.display_order contains a key more than once,
then the according line in the bibentry will also be created more than once.
E.g.:

import bibtexparser
bib_dict = {'ID': 'a', 'ENTRYTYPE': 'misc', 'title': 'b', 'year': '1'}
my_db = bibtexparser.bibdatabase.BibDatabase()                               
my_db.entries = [bib_dict]
writer = bibtexparser.bwriter.BibTexWriter()                                           
writer.display_order = ['title', 'dummy', 'title'] 
print( bibtexparser.dumps(my_db, writer)) 

results in

@misc{a,
 title = {b},
 title = {b},
 year = {1}
}

I do not even claim that this is a bug, but maybe a short comment in the documentation could be added.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions