Document template partials

This commit is contained in:
2026-06-16 15:45:23 +00:00
parent a13f04fce5
commit 4f755704d9
2 changed files with 28 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ Tomorrow, and Hourly.
The package embeds assets from:
- `internal/reporttemplate/templates/*.md.tmpl`
- `internal/reporttemplate/templates/partials/*.md.tmpl`
- `internal/reporttemplate/schemas/*.schema.json`
Generated-text prompt source files live under
@@ -73,6 +74,12 @@ template and renders from `generatedtext.DailyRenderContext`.
Templates use `text/template` with `missingkey=error`, so missing context fields
fail rendering instead of producing incomplete Markdown.
Daily and Tomorrow call the shared `daypart_forecast` partial. Today calls
`today_daypart_forecast` so it can omit elapsed or missing dayparts. Daily,
Today, and Tomorrow call the shared `precipitation_timing` partial. Partial
files are parsed with each top-level template at render time and receive the
same typed render context as the caller.
## Schema Contract
The GeneratedText schemas describe the structured prose Scriptorium is expected
@@ -92,6 +99,7 @@ slots consumed by the template.
- Unknown template IDs return actionable lookup errors.
- Unknown schema IDs return actionable lookup errors.
- Template parse errors include the template ID.
- Partial read or parse errors include the partial path.
- Template execution errors include the template ID and usually identify the
missing context field.
@@ -107,6 +115,7 @@ Inspect:
## Invariants
- Embedded templates and schemas live as separate files, not inline Go strings.
- Shared Markdown partials live under `templates/partials/`.
- Report definitions select templates by ID.
- Templates render from curated render contexts, not raw data packages.
- GeneratedText schemas describe LLM prose slots, not deterministic weather