feat: render JSON Resume references section#83
Conversation
f3abec5 to
a97da10
Compare
📝 WalkthroughWalkthroughAdds a ChangesReferences Section Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
a97da10 to
e8a31b3
Compare
Renders `references[]` entries (each `{name, reference}`) as a
referee heading with the quote attributed beneath in italic, joined
by the standard divider rule. Entries missing the `reference` quote
are silently skipped; entries with no `name` render as an anonymous
quote.
Adds `preferences.referencesAvailableOnRequest` (default `false`).
When `true` and the section is rendered with no valid entries, emits
the conventional "References available upon request." line under
the heading instead of suppressing the section — a common CV idiom
that removes the need to manually toggle the section on or off.
Localisable via `labels.referencesAvailableOnRequest`.
Wired into `_sections` at `column: "right"`, appended to the default
`rightColumnSections` order so it surfaces automatically.
Closes #46
c5d3352 to
0fd8f4c
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib.typ`:
- Line 1175: Rename the parameter `available_on_request` to
`available-on-request` in the `_references` function signature at line 1175 to
match the file's established kebab-case convention for multi-word parameter
names. Then update the function call site at line 1329 to use the new kebab-case
parameter name `available-on-request` instead of snake_case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2d873cce-4cdc-4590-82fc-cc2134740788
⛔ Files ignored due to path filters (2)
examples/preview.pngis excluded by!**/*.pngexamples/tests/references.pdfis excluded by!**/*.pdf
📒 Files selected for processing (4)
README.mdlib.typtests/empty_sections.typtests/references.typ
| // it. When `availableOnRequest` is true and no valid entries remain | ||
| // (empty list, missing list, or all entries lacked a quote), render | ||
| // the conventional "References available upon request" line instead. | ||
| #let _references(entries, labels, available_on_request: false) = { |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Use kebab-case for the parameter name to match file convention.
The parameter available_on_request uses snake_case, but the file's established convention for multi-word parameter names is kebab-case (e.g., image-size, link-contact-info, header-text-align in _header at lines 659–665). Rename it to available-on-request for consistency.
♻️ Proposed fix
-#let _references(entries, labels, available_on_request: false) = {
+#let _references(entries, labels, available-on-request: false) = {
let valid = entries.filter(r => _present(r.at("reference", default: none)))
if valid.len() == 0 {
- if not available_on_request { return }
+ if not available-on-request { return }
[== `#labels.references`]Also update the call site at line 1329:
render: (cv, labels, prefs) => _references(
cv.at("references", default: ()),
labels,
- available_on_request: prefs.referencesAvailableOnRequest,
+ available-on-request: prefs.referencesAvailableOnRequest,
),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@lib.typ` at line 1175, Rename the parameter `available_on_request` to
`available-on-request` in the `_references` function signature at line 1175 to
match the file's established kebab-case convention for multi-word parameter
names. Then update the function call site at line 1329 to use the new kebab-case
parameter name `available-on-request` instead of snake_case.
|
Superseded by #121 — fresh branch off main rather than rebasing across the |
Closes #46. Adds `_references` renderer for JSON Resume's `references[]`: each entry's `name` as a level-3 heading with the `reference` quote in italic beneath, joined by the standard divider rule. Entries missing the `reference` quote are silently skipped (no orphan heading); entries with no `name` render the quote anonymously. Adds `preferences.referencesAvailableOnRequest` (default `false`). When `true` and the section has no valid entries (empty / missing data, or every entry skipped), emits the conventional `References available upon request.` line under the heading instead of suppressing the section. The line text is `labels.referencesAvailableOnRequest` so it localises alongside the other display strings. Wired into `_sections` at `column: "right"`; appended to the default `rightColumnSections` order so existing users get the section automatically once they populate `references[]`. Supersedes #83 — that branch predates the `internal/`/`sections/` module split and the move of label defaults into `internal/labels-en.toml`.
## Summary Closes #46. Renders JSON Resume's `references[]` — each entry's `name` as a level-3 heading with the `reference` quote in italic beneath, joined by the standard divider rule. Entries missing the `reference` quote are silently skipped (no orphan heading); entries with no `name` render the quote anonymously so the data still surfaces. Adds `preferences.referencesAvailableOnRequest` (default `false`). When `true` and the section has no valid entries, emits the conventional `References available upon request.` line under the heading instead of suppressing the section. Localised via `labels.referencesAvailableOnRequest`. Wired into `_sections` at `column: "right"`; appended to the default `rightColumnSections` order so existing users get the section automatically once they populate `references[]`. Supersedes #83 — that branch predates the `internal/`/`sections/` module split and the move of label defaults into `internal/labels-en.toml`. ## Design - `name` rendered as `===` (level-3 heading), matching `awards` / `projects`. - `reference` rendered as `emph(...)` underneath the name. - Entries joined by the standard `_join_with_dividers` rule, wrapped in a `breakable: false` block so a single entry doesn't split across pages. - Renderer logic is a three-way cascade: no valid entries + no fallback → suppress; no valid entries + fallback → heading + italic line; valid entries → heading + dividered blocks. - `references` and `referencesAvailableOnRequest` keys added to `internal/labels-en.toml` so translators have a single resource file to update. - `_check_bool("referencesAvailableOnRequest", ...)` added alongside the other bool validations in `alta()`. - `example_full.typ` gains a populated `references` block (one named + one anonymous quote) so the gallery exercises both paths. ## Test plan - [x] `make test` — every example + fixture compiles - [x] `make test-template` — `template/cv.typ` still compiles via the sed-swap path - [x] `make example-full` — regenerated `examples/example_full.pdf` and the page-2 PNG; gallery alt text updated - [x] `make examples/tests/references.pdf` — 3-page fixture covering populated entries, the available-upon-request fallback, and the default-suppressed path - [x] Visual check of all three fixture pages — heading, dividers, italic quotes, and the anonymous-quote path all render as designed - [x] README updated — new `References` subsection, label table entries (`references`, `referencesAvailableOnRequest`), `referencesAvailableOnRequest` preferences row, removal from the "not yet rendered" list, addition to the top-level keys list, addition to both column-keys lists (right-column default + single-column streaming order) ## JSON Resume alignment ALIGNS — JSON Resume defines `references[]` with `name` and `reference` fields (https://jsonresume.org/schema/); this PR renders both. The `preferences.referencesAvailableOnRequest` opt-in is a template extension for the no-references-supplied case. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for rendering a References section from JSON Resume `references[]`, with an option to show “References available upon request” when no usable reference data is present. * **Documentation** * Expanded README with References schema and preference configuration details. * Added new English labels for the References heading and the on-request fallback. * Updated gallery alt text to mention references in the rendered content. * **Examples & Tests** * Updated the full CV example to include populated References entries. * Added/updated test coverage for populated, empty-with-fallback, and empty-suppressed rendering paths. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Shane Murphy <shane@swissborg.com>
Summary
Closes #46. Renders the JSON Resume
references[]section: each entry'snameas a level-3 heading with thereferencequote in italic beneath, joined by the standard divider rule. Entries missing thereferencequote are silently skipped; entries with nonamerender as an anonymous quote.Adds
preferences.referencesAvailableOnRequest(defaultfalse). Whentrueand the section is rendered with no valid entries (empty data, missing data, or every entry skipped), emits the conventional "References available upon request." line under the heading instead of suppressing the section. Localisable vialabels.referencesAvailableOnRequest.Wired into
_sectionsatcolumn: "right"; appended to the defaultrightColumnSectionsorder so existing users get the section automatically once they populatereferences[].Rendered output
Compiles via
typst compile --root . tests/references.typ— three-page fixture exercises the populated case, the empty + opt-in fallback case, and the empty + default suppressed case. CI will upload the rendered PDFs.Test plan
typst compile --root . examples/example.typ examples/example.pdfsucceedstests/*.typfixture compiles (including newtests/references.typ)tests/covering populated entries, the available-upon-request fallback, and the default-suppressed pathreferencesAvailableOnRequestpreference row, removal from the "not yet rendered" list, and added to the section-keys listNotes for the reviewer
availableOnRequest. I prefixed it toreferencesAvailableOnRequestso it's self-documenting in the flatpreferencesnamespace (consistent withgroupCertificates,uppercaseName,linkContactInfo, etc).labels.referencesAvailableOnRequestrather than hard-coded so it can be localised alongside the other display strings the template emits.JSON Resume alignment
ALIGNS — JSON Resume defines
references[]withnameandreferencefields (https://jsonresume.org/schema/). This PR renders both. Thepreferences.referencesAvailableOnRequestopt-in is a template extension for the no-references-supplied case.Summary by CodeRabbit