Conversation
…readers Biblatex files (e.g. Zotero's Better BibTeX exports) use 'date' and 'journaltitle' where bibtex has 'year'/'month'/'day' and 'journal'. bibentry() then refuses Article etc. entries, so readBib() dropped them with a warning, both with direct = TRUE and direct = FALSE. process_ref(), shared by both bibtex readers, now maps these fields, mirroring pandoc's (and biber's) handling: - a parsable 'date' ([-]YYYY[-MM[-DD]], optionally with range, time or EDTF qualifiers) sets year/month/day, overriding the bibtex fields; - 'journaltitle' overrides 'journal'; - 'location' supplies 'address' if missing (not for patents, where it is the jurisdiction). The biblatex fields are kept. Recovers 52 previously dropped entries of inst/bib/biblatex-examples; no other bundled bib file changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ms609
marked this pull request as ready for review
September 16, 2026 10:02
Owner
|
Many thanks. I am still travelling but will deal with this at the beginning of October. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I use Zotero with Better BibTeX to manage citations. Exported bib entries (and biblatex files in general) use
dateandjournaltitlewhere BibTeX hasyear/month/dayandjournal, e.g.utils::bibentry()rejects such anArticle(nojournal, noyear), soreadBib()drops the entry with a warning under bothdirect = TRUEanddirect = FALSE. Downstream, Rdpack's\insertCitethen cannot cite it.I've been manually replacing
journaltitlewithjournal, and truncatingdatetoyear(and often forgetting to to this!). But as the same.bibworks in R Markdown/Quarto vignettes (pandoc understands these fields), I wondered whether it might be possible for these fields to be supported here also.I set Claude onto the task; this PR is the result. I've tested the code locally and it succeeds.
Change
process_ref()insrc/common_bt_btd.c(shared by thebibtexinandbibtexdirectinreaders) now normalises these biblatex fields, following pandoc's citeproc BibTeX reader (and biber):date: if it has the form[-]YYYY[-MM[-DD]], optionally followed by EDTF qualifiers (~ ? %), a time (T…) or a range (/…), it setsyear,month(full month name, as formonth = feb) andday, taking precedence over anyyear/month/dayfields. An unparsabledate(e.g.circa 2004) is ignored andyearis used. For a range, only the start is used, sincebibentryhas no range.journaltitletakes precedence overjournal.locationsuppliesaddressif that is missing, except for@patent, where biblatex'slocationis the jurisdiction.The biblatex fields themselves are kept (visible with
direct = TRUE).Checks
inst/bib/biblatex_aliases.bib, run with bothdirect = TRUEandFALSE; it fails without the patch.readBib()output for every file ininst/bib/before and after, with both values ofdirect: the only file whose output changes isbiblatex-examples_sans_key_aksin.bib, which now returns 84 rather than 32 entries (direct = TRUE) and 70 rather than 17 (direct = FALSE). Nothing previously read changes except for addedyear/journal/addressfields.pandoc --citeprocon year, month, journal and place.-Wall -pedantic.Documented in
?readBib(Details) and NEWS.md.🤖 Generated with Claude Code