charlesvdv / nom-bibtex

A feature complete bibtex parser using nom
https://docs.rs/nom-bibtex
MIT License
22 stars 15 forks source link

Allow parsing month abbreviations #16

Closed fangyi-zhou closed 2 years ago

fangyi-zhou commented 2 years ago

I was trying to use this library to parse my bib file, and encounted complaints regarding unresolved abbreviation 'dec', 'Mar', etc. Since many publishers use these abbreviations in exported bibtex, maybe it's a good idea to support them.

See also: https://www.bibtex.com/f/month-field/

charlesvdv commented 2 years ago

In the link you provided, it says:

Many BibTeX styles have built in macros that allow to use abbreviations

From my understanding, the month abbreviation are not directly in core language but in the bibtex styles themself. For example, the te.bst file defines those abbreviations as macros (ref).

Therefore, I am not inclined to include a change which is not included in the bibtex specification.

Doing the string abbreviation logic in this library was maybe a mistake. I see two approaches that need to be investigated:

What do you think?

fangyi-zhou commented 2 years ago

Either solution is fine, the month macros are quite an oddity, but are used by some publishers when generating bibtex.

I personally prefer the first approach since it seems easier to configure.