sciunto-org / python-bibtexparser

Bibtex parser for Python 3
https://bibtexparser.readthedocs.io
MIT License
474 stars 132 forks source link

Bug in SeparateCoAuthors #479

Closed oborin1 closed 7 months ago

oborin1 commented 7 months ago

possibly duplicate of #475 Describe the bug SeparateCoAuthors fails to split the author string given below. It is the middlename that causes this problem.

Reproducing 2.0.0b7

Code: import bibtexparser import bibtexparser.middlewares as m

bibtex_str = """ @ARTICLE{Cesar20132, author = {Kharlamov, Yu A and Zhiltsov, A P}, } """ layers = [m.SeparateCoAuthors(), m.SplitNameParts()] library = bibtexparser.parse_string(bibtex_str, append_middleware=layers) for record in library.entries: for key, value in record.items(): if key == "ENTRYTYPE" and value == "article": if "author" in record.fields_dict.keys(): print(record["author"])


Bibtex:

@ARTICLE{Cesar20132, author = {Kharlamov, Yu A and Zhiltsov, A P}, }



**Workaround**
A dot after A solves the issue.
@ARTICLE{Cesar20132,
  author = {Kharlamov, Yu A. and Zhiltsov, A P},
}

**Remaining Questions (Optional)**
Why cannot we use .split(' and ') to separate persons?
Please tick all that apply:

- [x] I would be willing to contribute a PR to fix this issue.
- [x] This issue is a blocker, I'd be grateful for an early fix.