template

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateHTML

func ValidateHTML(htmlContent string) error

ValidateHTML performs comprehensive HTML validation including tag balance. This is the main entry point for template HTML validation.

func ValidateTagBalance

func ValidateTagBalance(htmlContent string) error

ValidateTagBalance validates that all HTML tags are properly balanced. It uses a stack-based approach to ensure every opening tag has a matching closing tag and that they are properly nested.

Returns nil if the HTML is valid, otherwise returns an error describing the first structural issue found.

Types

type Pongo2Renderer

type Pongo2Renderer struct {
	Debug       bool
	TemplateDir string
	// contains filtered or unexported fields
}

Pongo2Renderer is a custom Gin renderer using Pongo2.

func NewPongo2Renderer

func NewPongo2Renderer(templateDir string, debug bool) *Pongo2Renderer

NewPongo2Renderer creates a new Pongo2 renderer.

func (*Pongo2Renderer) HTML

func (r *Pongo2Renderer) HTML(c *gin.Context, code int, name string, data interface{})

HTML renders an HTML template.

func (*Pongo2Renderer) Instance

func (r *Pongo2Renderer) Instance(name string, data interface{}) *pongo2.Template

Instance returns a Pongo2 template instance, using cache if not in debug mode.

func (*Pongo2Renderer) Render

func (r *Pongo2Renderer) Render(c *gin.Context, code int, name string, data interface{}) error

Render renders a Pongo2 template.

Jump to

Keyboard shortcuts

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