minicomponents

package module
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 5 Imported by: 1

README

minicomponents

Component support for Go templates (html/template and text/template)

WIP. TODO. MIT license.

Documentation

Index

Constants

View Source
const (
	RenderMethodNone = RenderMethod(iota)
	RenderMethodTemplate
	RenderMethodFunc
	RenderMethodFuncThenTemplate
)

Variables

This section is empty.

Functions

func Args added in v0.3.3

func Args(args ...any) map[string]any

func Rewrite

func Rewrite(templ string, baseName string, comps map[string]*ComponentDef) (string, error)

func WrapTemplate added in v0.3.0

func WrapTemplate(code string, prefix, suffix string) string

Types

type Arg

type Arg struct {
	Name  string
	Value string
}

type Component

type Component struct {
	Name string
	Body string
	Args []Arg
}

type ComponentDef

type ComponentDef struct {
	RenderMethod RenderMethod
	FuncName     string
	TemplateName string
	SlotName     string
	HasSlots     bool
}

func ScanTemplate added in v0.3.0

func ScanTemplate(code string) *ComponentDef

type ParseErr

type ParseErr struct {
	Code string
	Pos  int
	Line int
	Msg  string
}

func (*ParseErr) Error

func (e *ParseErr) Error() string

type RenderMethod

type RenderMethod int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL