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

Bugs in @string parsing #31

Open
goerz opened this issue Mar 3, 2023 · 2 comments
Open

Bugs in @string parsing #31

goerz opened this issue Mar 3, 2023 · 2 comments

Comments

@goerz
Copy link

goerz commented Mar 3, 2023

The parsing of @string entries seems to have some bugs:

import BibParser

bibtex = """
@string{foo = {Mrs. Foo}}

@string {bar = "Mr. Bar"}
"""

BibParser.BibTeX.parse_string(bibtex; check=:error)

results in

Warning: The entry is incomplete and end from (line 1, character 13) to (line 3, character 1): '= {Mrs. Foo}}'
Warning: The entry kind is invalid from (line 3, character 2) to (line 3, character 9): '@string'

The first @string using braces instead of quotes may not actually be in line with the description at http://www.bibtex.org/Format/, but it is definitely accepted by bibtex, and, more importantly, it's what BibDesk generates. The second @string with a space before the opening brace is directly from http://www.bibtex.org/Format/. It's not a format I personally use, but it should definitely be valid.

@Azzaare
Copy link
Member

Azzaare commented Mar 6, 2023

Good catch! Thank you.

I don't see the issue in parsing entries that are not fitting exactly BibTeX format description. As long as it doesn't conflict with the format, I am fine with any addition.

Adding the option to parse without errors, both string entries in your example should be quick (I am quite busy until mid-March though). However, it also touches one issue that is to handle and/or replace the entries of @string in the parsed bibliography. I will try to get all of those done during March.

@goerz
Copy link
Author

goerz commented Mar 6, 2023

No rush… I can work around this and #32 by adjusting the .bib file a bit, so it's not really a dealbreaker. Maybe I'll have a look at if I can make a PR to fix this, too.

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