Fragments (ghtmx)
fragment Name(params) { … } declares a compile-time fragment —
nested inside a template it renders inline at the declaration site
with arguments bound by name from the enclosing scope, top-level it
only declares. Each fragment compiles to one shared body with two
entry points: Name(...) ghtmx.Component (inline) and
NameFragment(...) ghtmx.Fragment (standalone), byte-identical for
identical inputs (FR-031). Fragment bodies see only their declared
parameters.
templ userTable(users []User) {
<table>
for _, u := range users {
fragment userRow(u User) {
<tr><td>{ u.Name }</td></tr>
}
}
</table>
}
AST: FragmentDeclaration.
Verified by: examples/fragments, examples/crud,
conformance, internal/parser, internal/analyzer.