htmlrenderer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package htmlrenderer provides an interface and its implementations for rendering HTML pages.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultRootDir is the default root directory.
	DefaultRootDir = filepath.FromSlash("templates/")

	// DefaultLayoutsDir is the default layout directory. Relative to root directory.
	DefaultLayoutsDir = filepath.FromSlash("layouts/")

	// DefaultExtension is the default template file extension.
	DefaultExtension = ".html"

	// ErrTemplateNotFound is the internal error when template is not found.
	ErrTemplateNotFound = errors.New("template not found")
)

Functions

func Default

func Default(debug bool) *defaultHTMLRenderer

Default returns a new default HTML renderer.

func New

func New(templatesDir, layoutsDir, extension string, debug bool) *defaultHTMLRenderer

New returns a new HTML renderer.

Types

type HTMLRenderer

type HTMLRenderer interface {
	// RenderHTML renders html template
	RenderHTML(res http.ResponseWriter, path string, data any)
}

HTMLRenderer is the interface for rendering

Jump to

Keyboard shortcuts

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