html

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package html facilitates use of html/template.Template

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobFS

func GlobFS(fSys fs.FS, patterns ...string) ([]string, error)

GlobFS returns a list of files matching content. If no patterns are provided, all files will be listed. If multiple patterns match the same file, they'll only be listed once.

func ParseFS

func ParseFS(fSys fs.FS, patterns ...string) (*template.Template, error)

ParseFS parses file on the given fs.FS, optionally filtered by the given patterns. As opposed to the standard template.ParseFS, templates will be names using the full path structure, not only the file name.

Types

type Template

type Template[T any] template.Template

Template is a type-safe variant of template.Template

func Lookup

func Lookup[T any](t *template.Template, name string) (*Template[T], error)

Lookup attempts to find a named template and returns the type-safe variant.

func (*Template[T]) Clone

func (t *Template[T]) Clone() (*Template[T], error)

Clone makes a copy of a typed template.

func (*Template[T]) Execute

func (t *Template[T]) Execute(w io.Writer, data T) error

Execute writes the result of combining the provided data with the Template.

func (*Template[T]) Sys

func (t *Template[T]) Sys() *template.Template

Sys returns the underlying template.Template

Jump to

Keyboard shortcuts

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