-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Description
Describe the bug
In the following example, the value of field 10 # "~" # jan is expected to be 10~Jan. but the output of this library is 10 # "~".
BibTeX has three types of field tokens: nonnegative number, macro name (like jan), and a brace-balanced string delimited by either double quotes or braces. They can be concatenated by the # character. Although the first type is called "number", it behaves the same as a string and it can be applied with string slicing, text length, and concatenation in a .bst style.
BTW, I've also made a bib2json.bst style that may help testing. It reads .bib data and writes JSON format (though with some limitations) to the .bbl output.
Reproducing
Version: 2.0.0b2
Code:
import bibtexparser
bibtex_str = '''
@STRING{ jan = "Jan." }
@INBOOK{inbook-full,
month = 10 # "~" # jan,
}
'''
library = bibtexparser.parse_string(bibtex_str)
month = library.entries[0].fields_dict['month'].value
print(month.__repr__())
assert month == "10~Jan."Output:
'10 # "~"'