Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context[T any] struct { // Content is an inner HTML of a component tag. Content template.HTML // Attrs is a map of HTML attributes of the component tag. Attrs map[string]string // DB is an interface for accessing external data. DB T }
Context is passed to each component when rendering.
Context has a generic parameter for data interface, which can be customized by client code.
type Engine ¶
type Engine[T any] struct { // contains filtered or unexported fields }
Engine renders HTML page with components. See RenderPage for details.
func (*Engine[T]) RenderPage ¶
RenderPage renders an HTML page by replacing component tags with rendered versions.
It scans HTML page for tags that have a matching <tag>.gohtml file in the component directory. This component is then rendered from a template file and is appended back to the main HTML.
Click to show internal directories.
Click to hide internal directories.