typst / biblatex

A Rust crate for parsing and writing BibTeX and BibLaTeX files.
Apache License 2.0
133 stars 17 forks source link

Allow inline comments #64

Open jakewilliami opened 1 month ago

jakewilliami commented 1 month ago

Hi team, thanks for all the work on this library! It's very useful for a simple use-case I have.

I have encountered an issue with some of my bibliographies not parsing, for example:

@article{fischer2019primer,
  title={A primer to (cross-cultural) multi-group invariance testing possibilities in {R}},
  author={Fischer, Ronald and Karl, Johannes A},
  journal={Frontiers in Psychology},
  pages={1507}, % A comment here
  year={2019},
  publisher={Frontiers},
  doi={10.3389/fpsyg.2019.01507}
}

This is because there is a comment after one of the fields. This is allowed by the BibLaTeX (as far as I know), but not by Typst's biblatex. Are there any plans to support these comments in future?

N.B.—: I've always been a little confused about comments in bibliographies, as Emacs tried to add comments as @Comment but BibLaTeX never seems to like this. Perhaps that's a deprecated comment style. I've never bothered to read into it...

jakewilliami commented 1 month ago

This issue also arises when you have a bib entry that is entirely commented out. So this will parse:

% Some comment outside of the citation block

@article{fischer2019primer,
  title={A primer to (cross-cultural) multi-group invariance testing possibilities in {R}},
  author={Fischer, Ronald and Karl, Johannes A},
  journal={Frontiers in Psychology},
  pages={1507},
  year={2019},
  publisher={Frontiers},
  doi={10.3389/fpsyg.2019.01507}
}

But this will not:

% Some comment outside of the citation block

% @article{fischer2019primer,
%   title={A primer to (cross-cultural) multi-group invariance testing possibilities in {R}},
%   author={Fischer, Ronald and Karl, Johannes A},
%   journal={Frontiers in Psychology},
%   pages={1507},
%   year={2019},
%   publisher={Frontiers},
%   doi={10.3389/fpsyg.2019.01507}
% }

Is that expected?

By the way, I like that you allow trailing commas in the last field of the entry. I don't think my BibLaTeX system likes it when i do that.