Skip to content

Add data-raw/regenerate_bib.R helper for vignettes/references.bib#70

Merged
NewGraphEnvironment merged 1 commit into
mainfrom
69-regenerate-bib-helper
May 7, 2026
Merged

Add data-raw/regenerate_bib.R helper for vignettes/references.bib#70
NewGraphEnvironment merged 1 commit into
mainfrom
69-regenerate-bib-helper

Conversation

@NewGraphEnvironment
Copy link
Copy Markdown
Owner

Summary

  • Formalizes the bib regen recipe that's been hand-bombed since v0.2.6 (kootenay wire-up). One small helper + comments at the top of each vignette + a CLAUDE.md note. Conservative option — doesn't break CI (which has no Zotero/BBT).
  • data-raw/regenerate_bib.R — reads vignettes/kootenay-lake.Rmd + vignettes/peace-fwcp.Rmd, detects the union of citation keys via rbbt::bbt_detect_citations, pulls bib entries via rbbt::bbt_bib(..., .action = rbbt::bbt_return), writes vignettes/references.bib. Logs per-vignette key counts and flags any vignette-only keys for visibility. Verified idempotent on current main — writes the same 18 entries already there.
  • HTML comment block at the top of each vignette pointing to the helper. Initial drafts had a literal [@key] in the comment which rbbt picked up as a phantom citation (broke the helper on first run); reworded to "pandoc citation markers" to avoid the false positive — small but instructive bug.
  • CLAUDE.md Vignettes section gets a one-paragraph note covering: when to run it, BBT prerequisite, why CI doesn't run it.

Trade-off vs option 2 (embed rbbt::bbt_update_bib() in YAML at render time) and option 3 (pre-commit hook): option 2 always-freshes the bib but breaks pkgdown CI (no Zotero on the runner); option 3 is more involved. Option 1 here is the cheap-and-correct middle ground.

Relates to NewGraphEnvironment/sred-2025-2026#23.

Fixes #69.

Test plan

  • Helper runs cleanly on current main: detects 18 keys per vignette, writes 18 entries, idempotent (verified — single-line trailing-newline diff after first run, no diff thereafter)
  • lintr::lint('data-raw/regenerate_bib.R') → 0 lints (verified)
  • CI pkgdown render unaffected (helper isn't called by CI)
  • No vignette section restructuring; only HTML comments added
  • No new dependency added; rbbt was already a project dev tool

🤖 Generated with Claude Code

After v0.2.6 the bib was regenerated by hand whenever pandoc cite
markers changed in either regional vignette. This formalizes the
recipe — option 1 of the three discussed (conservative; doesn't
break CI):

- New `data-raw/regenerate_bib.R` reads both regional vignettes,
  detects the union of citation keys via rbbt::bbt_detect_citations,
  pulls bib entries via rbbt::bbt_bib + bbt_return action, writes
  to vignettes/references.bib. Logs key counts per vignette + any
  vignette-only keys for visibility. Verified idempotent on the
  current main (writes the same 18 entries already there).
- HTML comment block at the top of each regional vignette pointing
  to the helper. (Initial drafts had `[@key]` literals in the
  comments which rbbt detected as a phantom citation; reworded to
  "pandoc citation markers" to avoid the false positive.)
- CLAUDE.md Vignettes section gets a one-paragraph note pointing
  to the helper + listing the BBT prerequisite + clarifying CI
  doesn't run it.

Trade-off vs embedding the rbbt call in the YAML directly: that
would always-fresh the bib at render time but breaks pkgdown CI
(no Zotero on the runner). Pre-commit hook (option 3) was deferred
as more involved.

Refs #69.
@NewGraphEnvironment NewGraphEnvironment merged commit 147cabe into main May 7, 2026
1 check passed
@NewGraphEnvironment NewGraphEnvironment deleted the 69-regenerate-bib-helper branch May 7, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add data-raw/regenerate_bib.R helper for vignettes/references.bib

1 participant