templater

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 2 Imported by: 0

README

templater

package main

import (
	"html/template"
	"strings"

	"github.com/PengShaw/GoUtilsKit/templater"
)

func main() {
	funcs := template.FuncMap{"ToUpper": strings.ToUpper}
	r, err := templater.RenderText("_", "hello, {{ . | ToUpper }}!", "world", funcs)
	if err != nil {
		panic(err)
	}
	println(string(r))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderText

func RenderText(name, text string, data any, funcs template.FuncMap) ([]byte, error)

RenderText uses data to render a text/template with the given name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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