Documentation
¶
Index ¶
- func ExpandPartials(htmlStr string, fsys fs.FS, baseDir string) (string, error)
- func ExpandPartialsLayered(htmlStr string, layers []FSLayer, registry map[string]string) (string, error)
- func ExtractGAttrs(attrs string) string
- func IsLiteral(s string) bool
- func TransferAttrsToRoot(htmlStr string, attrs string) string
- func ValidateDirectives(htmlStr string, ci *island.Info) error
- type FSLayer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandPartials ¶
ExpandPartials takes HTML and recursively replaces custom element tags with partial content from a single filesystem (sibling-file lookup). This is the simple entry point; internally delegates to ExpandPartialsLayered.
func ExpandPartialsLayered ¶
func ExpandPartialsLayered(htmlStr string, layers []FSLayer, registry map[string]string) (string, error)
ExpandPartialsLayered takes HTML and recursively replaces custom element tags with partial content. For each tag it consults, in order:
- Each FSLayer at path.Join(layer.BaseDir, tag+".html")
- registry[tag] (registered via Engine.RegisterPartial / UsePartials)
If no source has the tag, an error is returned that lists every location searched to aid debugging.
func ExtractGAttrs ¶
ExtractGAttrs pulls out g-* attributes (and g-class:* etc.) from an attribute string.
func TransferAttrsToRoot ¶
TransferAttrsToRoot inserts attributes into the first opening tag of the HTML.
Types ¶
type FSLayer ¶
type FSLayer struct {
FS fs.FS
BaseDir string
// Label is shown in "not found" error messages to help identify which
// layer was searched (e.g. "island \"solar\" FS", "shared").
Label string
}
FSLayer is one filesystem search location for partial resolution. Layers are consulted in order; the first hit wins.