RFC: Cover letter module modernization (#96)#164
Conversation
Initial changes toward syncing the cover letter module with CV patterns: - Fix file comment (was incorrectly saying "CV template") - Import injection utility for upcoming keyword injection support - Add address-style parameter to _letter-header for case control Part of #96 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase A - Code consistency: - Read font size from metadata.toml instead of hardcoding 9pt - Add header-font handling for non-Latin languages (match CV pattern) - Add keyword injection support (ATS keywords in cover letter) - Add backward-compat panics for deprecated inject fields Phase B - User-requested features (#96): - sender-address defaults to auto, reads from metadata.personal.address - Add address-style parameter ("smallcaps" or "normal") - Update template with multiline address examples and usage comments Closes #96 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use calc.min(2, fonts.len()) instead of hardcoded index 2 when inserting non-Latin fonts. This prevents a crash when regular_fonts has fewer than 3 entries. Fixes both cv() and letter() functions. Fixes #165 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex Review this PR. |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b09d3d9210
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| // Backward compatibility: panic if old inject fields are detected | ||
| if metadata.inject.at("inject_ai_prompt", default: none) != none { |
There was a problem hiding this comment.
Guard access to inject config in letter()
This new direct dereference of metadata.inject will fail at runtime for metadata files that don't define an [inject] table (for example older or letter-only configs), so letter() now panics before rendering instead of using defaults. Because this access path was added in this commit, it introduces a backward-compatibility regression; read inject via metadata.at("inject", default: (:)) (or equivalent) before calling .at(...) on its keys.
Useful? React with 👍 / 👎.
Summary
Modernizes the cover letter module to sync with CV module patterns and addresses feature requests from #96.
Phase A: Code Consistency Fixes
metadata.tomlinstead of hardcoding9ptinject_ai_prompt/inject_keywordsfieldsPhase B: User-Requested Features (#96)
sender-addressdefaults toauto, reads frommetadata.personal.address(with manual override)address-styleparameter:"smallcaps"(default) or"normal"to control address caseOut of scope (follow-up issues)
importModules()— needs page setup mechanism changesTest plan
just build— CV compiles normallytypst compile template/letter.typ— letter compiles normally--input language=zh— non-Latin compiles for both CV and letter (was crashing before bug: non-Latin font insert crashes when regular_fonts has fewer than 3 entries #165 fix)Partially addresses #96
Fixes #165
🤖 Generated with Claude Code