bibtex-ruby icon indicating copy to clipboard operation
bibtex-ruby copied to clipboard

Braces in citekey

Open mapreal19 opened this issue 3 years ago • 2 comments

When a citekey has braces the parser can't handle it. Maybe we should strip them when processing?

The example bibtex I've got:

@book{book:{421090},
  title = {Fuzzy Reasoning in Information...)},
  author = {S.G. Tzafestas, Anastasios N. Venetsanopoulos},
}

Error

 BibTeX::ParseError:
       Failed to parse BibTeX on value "{" (LBRACE) ["@", #<BibTeX::Entry >, "book:"]
     # bibtex.y:138:in `on_error'
     # (eval):3:in `_racc_do_parse_c'
     # (eval):3:in `do_parse'
     # bibtex.y:111:in `parse'

Using the latex filter produces the same result.

mapreal19 avatar Jul 12 '21 08:07 mapreal19

I don't remember if BibTeX itself allows such keys, but I vaguely remember that we already made changes in the past to be less strict with the key syntax, so we can probably do the same here. If I'm not mistaken you'd just have to change the lexer pattern for keys here. You can probably test this at runtime even by adjusting BibTeX::Lexer.defaults or passing the options to Bibliography.parse which, I think, passes them through all the way to the lexer instantiation.

inukshuk avatar Jul 12 '21 12:07 inukshuk

ok! I'll try to make the change.

mapreal19 avatar Jul 13 '21 07:07 mapreal19