Skip to content

[FEATURE] Support selecting an alternate template per document - #1364

Merged
jaapio merged 1 commit into
mainfrom
feature/document-template-metadata
Aug 28, 2026
Merged

jaapio merged 1 commit into
mainfrom
feature/document-template-metadata

Conversation

@linawolf

@linawolf linawolf commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Add the generic :template: field-list metadata: TemplateNode,
TemplateFieldListItemRule to parse it, TemplateMetadataNodeRenderer to
render it as nothing (it's a marker, not visible content), and
DocumentNode::getTemplate() to expose the selected template name.

Split out of #1358 per review feedback -- the genindex work on that
branch is the first consumer (:template: genindex), but the
mechanism itself is generic and reviewable on its own.

Signed-off-by: lina.wolf lwolf@w-commerce.de

Assisted by claude-code:claude-opus-5 — Session

Add the generic ':template:' field-list metadata: TemplateNode,
TemplateFieldListItemRule to parse it, TemplateMetadataNodeRenderer to
render it as nothing (it's a marker, not visible content), and
DocumentNode::getTemplate() to expose the selected template name.

Split out of #1358 per review feedback -- the genindex work on that
branch is the first consumer (`:template: genindex`), but the
mechanism itself is generic and reviewable on its own.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PP4LkejR5PSubbhNmF4RkT
@linawolf
linawolf force-pushed the feature/document-template-metadata branch from e2a33b5 to 072e9da Compare August 28, 2026 13:58

@jaapio jaapio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also include an integration test for this new feature?

@linawolf

Copy link
Copy Markdown
Contributor Author

No integration test here: at this point :template: only reaches DocumentNode::getTemplate() — nothing consumes it yet, and TemplateMetadataNodeRenderer always renders it as an empty string regardless of the value. There's no observable output difference to assert end-to-end, so an integration test isn't possible for this PR in isolation.

The unit tests cover what's actually testable at this layer: TemplateFieldListItemRuleTest (parses :template: case-insensitively into a TemplateNode) and TemplateMetadataNodeRendererTest (only TemplateNode renders as nothing) — same pattern as the other marker fields (orphan, navigation-title).

An integration/fixture test showing the template actually affecting output belongs with the consumer — the genindex work on the follow-up branch, which reads getTemplate() === 'genindex'.

@linawolf
linawolf requested a review from jaapio August 28, 2026 15:50
@jaapio
jaapio merged commit 3411ed1 into main Aug 28, 2026
58 checks passed
@jaapio
jaapio deleted the feature/document-template-metadata branch August 28, 2026 19:58
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.

2 participants