sciunto-org / python-bibtexparser

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

Add `MergeNamePartsWithComma` middleware #421

Closed mlutze closed 7 months ago

mlutze commented 10 months ago

Is your feature request related to a problem? Please describe. Generally I would expect SplitNameParts and MergeNameParts to be semantic inverses. Consider:

last = [Peyton Jones], first = [Simon]
- merge -
Simon Peyton Jones
- split -
last = [Jones], first = [Simon Peyton]

We've lost the information that "Peyton Jones" was the full last name.

Describe the solution you'd like I'd like to have a MergeNameParts middleware that does the merge in the comma style. This would preserve the first/last information better.

Furthermore, due to the drawbacks of the space-separated strategy, I think the comma style should be the default.

Use cases This is important for any program that needs to manipulate names, as correctness of names can be lost when merging them back.

Describe alternatives you've considered The first-name-first order could possibly be maintained by surrounding the whole last name with braces (Simon {Peyton Jones}). I'm not sure this actually works, and it also has implications on capitalization, since I think some programs using BibTeX consider braces when capitalizing names, etc.

Remaining Questions (Optional) Please tick all that apply:

MiWeiss commented 10 months ago

Thanks for reporting.

Furthermore, due to the drawbacks of the space-separated strategy, I think the comma style should be the default.

I agree, this sounds reasonable.

We certaintly have to be able to provide a configuration that does the space-style merging though, as this what we provide in the corresponding v1 customization, if I recall correctly. Thus, people migrating from v1 may be looking for this!

Thanks a lot for willing to provide a PR!

The first-name-first order could possibly be maintained by surrounding the whole last name with braces (Simon {Peyton Jones})

I also like this proposition. We just have to be a little careful w.r.t. "von" and "jr" parts, which are sometimes hard to tell from 2-part last names. A look at the bibtex specs might help. Also this is a good reference regarding bibtex names...

Would you be willing to also open a PR for this? If so, feel free to do so in a separate PR, as you please. Feel also free to extract a standalone issue for this second part.

MiWeiss commented 7 months ago

Correct me if I'm wrong, but if I recall correctly this is closed by #422?