tmpl

package
v0.0.0-...-5130504 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var T = whtmpl.NewCollection().Funcs(template.FuncMap{
	"linkify": func(val string) (template.HTML, error) {
		tmpl := `{{.}}`
		if strings.HasPrefix(strings.ToLower(val), "http") {
			tmpl = `<a href="{{.}}">{{.}}</a>`
		}
		t, err := template.New("").Parse(tmpl)
		if err != nil {
			return "", err
		}
		var buf bytes.Buffer
		err = t.Execute(&buf, val)
		if err != nil {
			return "", err
		}
		return template.HTML(buf.String()), nil
	}})

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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