strtpl

package module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 3 Imported by: 6

README

strtpl

Little helper functions for using Golang's template syntax on a string – thoroughly tested.

For examples see the tests (they told you that good unit tests show how to use a package right? here you go!).

Documentation Coverage Status Go Report Card

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(templateString string, data interface{}) (output string, err error)

Eval applies Golang's text templating functions on a string with given data and returns the resulting string.

func EvalHTML added in v0.2.0

func EvalHTML(templateString string, data interface{}) (output string, err error)

EvalHTML applies Golang's html templating functions on a string with given data and returns the resulting string.

func EvalHTMLWithFuncMap added in v0.3.0

func EvalHTMLWithFuncMap(templateString string, funcs htmlTemplate.FuncMap, data interface{}) (output string, err error)

EvalHTMLWithFuncMap allows combining EvalHTML with a custom FuncMap.

func EvalWithFuncMap added in v0.3.0

func EvalWithFuncMap(templateString string, funcs textTemplate.FuncMap, data interface{}) (output string, err error)

EvalWithFuncMap allows combining Eval with a custom FuncMap.

func MustEval

func MustEval(templateString string, data interface{}) (output string)

MustEval applies Golang's text templating functions on a string with given data and returns the resulting string. In case of errors on the way, this function panics.

func MustEvalHTML added in v0.2.0

func MustEvalHTML(templateString string, data interface{}) (output string)

MustEvalHTML applies Golang's html templating functions on a string with given data and returns the resulting string. In case of errors on the way, this function panics.

func MustEvalHTMLWithFuncMap added in v0.3.0

func MustEvalHTMLWithFuncMap(templateString string, funcs htmlTemplate.FuncMap, data interface{}) (output string)

MustEvalHTMLWithFuncMap allows combining MustEvalHTML with a custom FuncMap.

func MustEvalWithFuncMap added in v0.3.0

func MustEvalWithFuncMap(templateString string, funcs textTemplate.FuncMap, data interface{}) (output string)

MustEvalWithFuncMap allows combining MustEval with a custom FuncMap.

Types

This section is empty.

Jump to

Keyboard shortcuts

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