sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.61k stars 97 forks source link

Escaping and brace nesting in bibtex field values #2075

Open Omikhleia opened 2 weeks ago

Omikhleia commented 2 weeks ago

Extracted from review comment https://github.com/sile-typesetter/sile/pull/2048#discussion_r1642004205

BibTeX allows two types syntax for (leaf-)string values in field:

Out bibtex implementation currently supports both on the surface, but things get much trickier inside these strings:

--> For full correct support, we may need to revise our grammar at some point (and or consolidate some entries differently).

alerque commented 2 weeks ago

Have you run across ABNF, EBNF, or any other formal grammars for BibTeX stuff or are there just a hodge–podge of implementations we're copying that might not even all match each other? Any links to grammars or parsers in any language would probably be useful when we go to address this.

alerque commented 1 week ago

From the soon to be closed PR, a still relevant comment:

For some elements (e.g. @string), I checked a few (non-grammar-based) implementations as well as a few ABNF grammars. But the rest is mostly from the biblatex manual and Tame the Beast. Problem is that most ABNF specifications I've found are incomplete... So yes, it ends up as a bit of a hodge-podge... (Hence also the "notes" on the format added in the documentation, as it's not clear to me that there's some full complete definition agreed by everyone and formally defined... Biber/biblatex keep adding stuff!)