JuliaDocs / DocumenterCitations.jl

DocumenterCitations.jl uses Bibliography.jl to add support for BibTeX citations and references in documentation pages generated by Documenter.jl.
https://juliadocs.github.io/DocumenterCitations.jl/
MIT License
72 stars 5 forks source link

Get year from date if missing #76

Open BeastyBlacksmith opened 2 weeks ago

BeastyBlacksmith commented 2 weeks ago

I got some .bib files that have date but not year and also journaltitle instead of journal. Might make sense to have a way to inject a mapping or something.

goerz commented 2 weeks ago

Maybe… I might be in the camp of "fix your .bib file". A missing year is probably quite problematic, since that enters into the (non-numeric) citation labels. Do you have a specific example (link to the .bib file in question)? I would potentially want to emulate whatever behavior RevTeX has.

Some of these things might also be upstream issues with Bibliography.jl, which definitely has some bugs and doesn't read every possible .bib file correctly. But fundamentally, the goal isn't necessarily to be able to handle every possible .bib file. Rather, it should be possible to write a clean .bib file specifically for DocumenterCitations that produces the desired result (or, at least a sensible result)

BeastyBlacksmith commented 3 days ago

Any bib-file I export using zotero looks like this

@article{bhatia_simple_2020,
    title = {Simple sugars shape giant vesicles into multispheres with many membrane necks},
    volume = {16},
    issn = {1744-683X, 1744-6848},
    url = {http://xlink.rsc.org/?DOI=C9SM01890E},
    doi = {10.1039/C9SM01890E},
    abstract = {...},
    pages = {1246--1258},
    number = {5},
    journaltitle = {Soft Matter},
    author = {Bhatia, Tripta and Christ, Simon and Steinkühler, Jan and Dimova, Rumiana and Lipowsky, Reinhard},
    urldate = {2020-04-05},
    date = {2020},
    langid = {english},
}

Sometimes the journaltitle is even missing.

I'd even argue that title, author and doi would be sufficient. In any case, I think that erroring is a bit harsh.

goerz commented 2 days ago

That .bib file has so many issues that it should never be used, in any context. I’m horrified that a tool as widely used as Zotero would export such garbage. But for the good of humanity, I would do anything to actively reject such a .bib, even if it could technically be made to work. It seems better to force people to this clean this up manually, or have a script in their workflow that does it automatically. Or, submit a report to Zotero, and maybe they can fix it.

The same goes for the auto-export from publisher’s websites. Those should never be used without proper cleanup (for this plugin or in LaTeX), and I will not support .bib files that come out of such tools.

I’ll give it a bit more thought, but I’m leaning towards a wontfix. The design philosophy laid out in the docs is deliberate. I would still recommend using or adapting the getbibtex script linked there or a similar tool.

goerz commented 2 days ago

I mean, I'm okay with making some pragmatic concessions while still keeping the "All .bib files must be curated by hand" policy in place. But in this case, Zotero is just exporting completely invalid bibtex. Both the journal and year fields are officially required for the @article type: https://www.bibtex.com/e/article-entry/

Please submit this as a bug to Zotero