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

TeX-like comments (for use with biber)

Open igneus opened this issue 7 years ago • 1 comments

I only use biber, never bibtex, and frequently make use of TeX-like comments (% and anything up to the end of line) just anywhere:

% outside of an entry
@book{ book,
% inside, separate line
author = "John Doe" % inside, after a field
}

biber is ok with that, bibtex-ruby crashes just like bibtex would. I usually strip comments before parsing the database:

BibTeX.parse(File.read(bib_path).gsub(/%.+?$/, ''))

My question is: do you find it desirable to handle bibtex-incomplatible biber-style comments in the gem? (Another question would be how - silently and always? optionally?) Or do you prefer to support only standard bibtex features?

igneus avatar Nov 15 '18 15:11 igneus

Content outside of an entry are totally fine (they are thrown away by the parser unless you include :meta_content in the options): this example should parse fine, for instance.

Comments inside entries are a different matter. It would be a good idea to have a 'strip_comments' option like you suggest (though, to be safe, I'd disable it by default for backwards compatibility).

inukshuk avatar Nov 15 '18 16:11 inukshuk