sciunto-org / python-bibtexparser

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

Add merging of names in last-name-first style #422

Closed mlutze closed 8 months ago

mlutze commented 10 months ago

I added a flag to MergeNameParts so the user can decide whether to use first-name-first or last-name-first. I made last-name-first the default.

I slightly modified one existing test group to support the flag.

I added a new test group test_merge_last_name_first_inverse which ensures that merging with commas is the inverse of splitting. I skip this test for cases including a /, since this property doesn't hold for some of those cases.

I also had to do a bit of strange stuff with the typing imports. The flag I added is a union of literal strings, but literal string types aren't available in Python 3.7. So I try importing a literal type and if that doesn't work then I just say the type of the flag is "str", which is too general but the closest I can get

MiWeiss commented 10 months ago

Thanks for your work on this. Just to avoid a misunderstanding: I wont review this PR while it is marked as draft.

mlutze commented 10 months ago

Thanks for your work on this. Just to avoid a misunderstanding: I wont review this PR while it is marked as draft.

Understood. There are still some changes to testing and documentation I'd like to make before submitting for review.

mlutze commented 10 months ago

@MiWeiss This is ready for review.

MiWeiss commented 8 months ago

Thanks again @mlutze for your PR, and sorry that the review took so long!