Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format names last, first #438

Closed
2 tasks done
tdegeus opened this issue Jan 18, 2024 · 2 comments
Closed
2 tasks done

Format names last, first #438

tdegeus opened this issue Jan 18, 2024 · 2 comments

Comments

@tdegeus
Copy link
Collaborator

tdegeus commented Jan 18, 2024

Is your feature request related to a problem? Please describe.
I would like to format names in the output as last, first

Describe the solution you'd like

bibtex_str = """
@ARTICLE{Cesar2013,
  author = {Jean César and T. W. J. de Geus},
  title = {An amazing title},
  year = {2013},
  volume = {12},
  pages = {12--23},
  journal = {Nice Journal}
}
"""

import bibtexparser
import bibtexparser.middlewares as m

layers = [
    m.SeparateCoAuthors(True),
    m.SplitNameParts(True)
]
library = bibtexparser.parse_string(bibtex_str, append_middleware=layers)

layers = [
    m.MergeNameParts(True),
    m.FormatNames("{last}, {first}"), # to be discussed!
    m.MergeCoAuthors(True)
]
print(bibtexparser.write_string(library, prepend_middleware=layers))

should then print

@ARTICLE{Cesar2013,
  author = {César, J. and de Geus, T. W. J.},
  title = {An amazing title},
  year = {2013},
  volume = {12},
  pages = {12--23},
  journal = {Nice Journal}
}

Use cases
In my experience, certain styles need this.

Describe alternatives you've considered

Remaining Questions (Optional)
Please tick all that apply:

  • I would be willing to to contribute a PR to fix this issue.
  • This issue is a blocker, I'd be greatful for an early fix.
@tdegeus
Copy link
Collaborator Author

tdegeus commented Jan 18, 2024

Seems addressed here #422 and discussed in #421

@MiWeiss MiWeiss mentioned this issue Jan 18, 2024
2 tasks
@MiWeiss
Copy link
Collaborator

MiWeiss commented Jan 18, 2024

Seems addressed here #422 and discussed in #421

As these are merged and closed now, I am also closing this issue. If anything remains unsolved for your usecase, we may be able to address it as part of #439 (which is conceptionally related), or in a new issue, as you prefer.

@MiWeiss MiWeiss closed this as completed Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants