bib2df icon indicating copy to clipboard operation
bib2df copied to clipboard

bib variables with '.' in name

Open courtney-bryce-hilton opened this issue 2 years ago • 2 comments

Hi, thanks for the great package.

I have found an edge-case that causes an issue with writing valid .bib files with df2bib. Specifically, I had a .bib entry that had 2 DOI values, like the following:

@article{test2022, doi = {DOI_PLACEHOLDER}, doi = {DOI_PLACEHOLDER2} }

parsing this with bib2df, and then rewriting it with df2bib, then results in something like:

@article{test2022, doi = {DOI_PLACEHOLDER}, doi.1 = {DOI_PLACEHOLDER2} }

However, '.' is not a valid character for a variable name for .bib files (I think; at least had issues knitting a .rmd).

I suspect this would be an easy fix, where you could substitute '.' in variable names with '_' or something?

Cheers

courtney-bryce-hilton avatar Mar 14 '22 18:03 courtney-bryce-hilton

I think this is caused by a tidyverse assumption when getting duplicate col names, reading through bib2df code now to see where this could be fixed.

HedvigS avatar Apr 03 '24 13:04 HedvigS

On second though, I'm not sure this is really a bug. You shouldn't have duplicate fields in entries to start with, so the fact that something is breaking here may actually be a good thing as it alerts you to it.

You should be getting this warning:


Some BibTeX entries may have been dropped.
            The result could be malformed.
            Review the .bib file and make sure every single entry starts
            with a '@' 

What do you think @giabaio ?

HedvigS avatar Apr 03 '24 14:04 HedvigS