Repository navigation
fix: format BibTeX names with Jr parts and braced "and" - #2157
Open
jayhemnani9910 wants to merge 1 commit into
Open
jayhemnani9910 wants to merge 1 commit into
jayhemnani9910 wants to merge 1 commit into
Conversation
Authors were split on every " and " after braces were removed, so a
braced corporate name such as {Food and Agriculture Organization} became
two people, and "King, Jr., Martin Luther" came out as "Jr., Martin Luther
King". Split names and name parts only outside braces, and order the
three-part "Last, Jr, First" form as "First Last Jr".
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
_format_authorsremoves braces first and then splits on" and "and the first comma. In BibTeX, braces protect a name, and a name can have three parts (Last, Jr, First). So:author = {King, Jr., Martin Luther and {Food and Agriculture Organization}}Before:
**Authors:** Jr., Martin Luther King, Food, Agriculture OrganizationAfter:
**Authors:** Martin Luther King Jr., Food and Agriculture OrganizationField values now keep their braces when read; names and name parts are split only outside braces, and the braces are removed when a value is displayed. Corporate authors in double braces are what Zotero writes for institutions, so names like this come up in exported libraries.
A regression test is added to
tests/utils/test_bibtex_converter.py; it fails ondevand passes with this change.Related Issues
Module(s) Affected
utilstestsChecklist
dev(notmain— see the base-branch selector above).pre-commit run --all-filesand fixed any issues. (Ranruff checkandruff format --checkon the changed files, andpytest tests/utils: 143 passed.)