Help us shape the future of Go! Take the 2026 Go Developer Survey

html

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	Templates       map[string]*Template
	TemplateOptions []string
	// contains filtered or unexported fields
}

Document is a new HTML document

func New

func New(entry string, ctx any) *Document

New creates a new document

func (*Document) NewTemplate

func (doc *Document) NewTemplate(
	name string,
	r io.Reader,
	funcs ...template.FuncMap,
) (*template.Template, error)

NewTemplate creates a new template without registering it

func (*Document) RegisterTemplate

func (doc *Document) RegisterTemplate(name string, r io.Reader, funcs ...template.FuncMap) error

RegisterTemplate registers a single template

func (*Document) RegisterTemplatePath

func (doc *Document) RegisterTemplatePath(path string) error

RegisterTemplatePath registers all templates in a folder

func (*Document) RegisterTemplates

func (doc *Document) RegisterTemplates(fileSystem fs.FS) error

RegisterTemplates registers templates in a fs.FS filesystem

func (*Document) RenderHTML

func (doc *Document) RenderHTML(w io.Writer) error

RenderHTML renders the HTML document

func (*Document) RenderTemplates

func (doc *Document) RenderTemplates()

RenderTemplates pre-renders all templates

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template is an html/template wrapper

func (*Template) Render

func (t *Template) Render(ctx any) (string, error)

Render renders a template

Jump to

Keyboard shortcuts

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