Documentation
¶
Index ¶
- func SetContextHelpers(getLanguage func(*gin.Context) string, getUserID func(*gin.Context, uint) uint)
- func SetMaintenanceCheckerFactory(f func(*sql.DB) MaintenanceChecker)
- func ValidateHTML(htmlContent string) error
- func ValidateTagBalance(htmlContent string) error
- type MaintenanceChecker
- type Pongo2Renderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetContextHelpers ¶
func SetContextHelpers(getLanguage func(*gin.Context) string, getUserID func(*gin.Context, uint) uint)
SetContextHelpers injects product-side context helper functions.
func SetMaintenanceCheckerFactory ¶
func SetMaintenanceCheckerFactory(f func(*sql.DB) MaintenanceChecker)
SetMaintenanceCheckerFactory injects a factory from product code.
func ValidateHTML ¶
ValidateHTML performs comprehensive HTML validation including tag balance. This is the main entry point for template HTML validation.
func ValidateTagBalance ¶
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 MaintenanceChecker ¶
type MaintenanceChecker interface {
IsActive() (*platformmodels.SystemMaintenance, error)
IsComing(withinMinutes int) (*platformmodels.SystemMaintenance, error)
}
MaintenanceChecker checks for active system maintenance. Product code injects a concrete *repository.SystemMaintenanceRepository via SetMaintenanceCheckerFactory.
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.