35 lines
759 B
Go
35 lines
759 B
Go
// SPDX-Licence-Identifier: EUPL-1.2
|
|
|
|
package main
|
|
|
|
import html "dappco.re/go/core/html"
|
|
|
|
// renderLayout builds an HLCRF layout from slot nodes and renders it.
|
|
// The helper is shared by the JS entrypoint and host-side tests so the
|
|
// slot-to-layout mapping stays covered outside the wasm build.
|
|
func renderLayout(variant, locale string, slots map[string]html.Node) string {
|
|
ctx := html.NewContext(locale)
|
|
layout := html.NewLayout(variant)
|
|
|
|
for _, slot := range canonicalSlotOrder {
|
|
node, ok := slots[slot]
|
|
if !ok || node == nil {
|
|
continue
|
|
}
|
|
|
|
switch slot {
|
|
case "H":
|
|
layout.H(node)
|
|
case "L":
|
|
layout.L(node)
|
|
case "C":
|
|
layout.C(node)
|
|
case "R":
|
|
layout.R(node)
|
|
case "F":
|
|
layout.F(node)
|
|
}
|
|
}
|
|
|
|
return layout.Render(ctx)
|
|
}
|