Skip to content

Conversation

@s-heppner
Copy link
Owner

Previously, the parser did not account for the possibility of equal signs (=) in the values of fields and would result in crashing the script with a non descriptive error message, due to expecting a simple string.split("=") to work.

However, it is completely possible to have equal signs in the value, for example in an URL field: URL = "https://example.org/query?x=1".

This adapts the parsing logic, making it stable against equal signs in field values. Furthermore, it cleans up the BibTeXEntry.from_string method a little bit and adds additional test cases to the unittests.

Fixes #3

Previously, the parser did not account for the possibility of equal
signs (`=`) in the values of fields and would result in crashing the
script with a non descriptive error message, due to expecting a simple
`string.split("=")` to work.

However, it is completely possible to have equal signs in the value,
for example in an URL field: `URL = "https://example.org/query?x=1"`.

This adapts the parsing logic, making it stable against equal signs in
field values. Furthermore, it cleans up the `BibTeXEntry.from_string`
method a little bit and adds additional test cases to the unittests.

Fixes #3
@s-heppner s-heppner force-pushed the fix/field_values_with_equal_signs branch from ceb0613 to 9ad2f5c Compare May 4, 2025 17:53
@s-heppner s-heppner merged commit cba9bec into main May 4, 2025
2 checks passed
@s-heppner s-heppner deleted the fix/field_values_with_equal_signs branch May 4, 2025 17:54
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

Successfully merging this pull request may close these issues.

Parser fails if field value contains =

2 participants