tmpl

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 12 Imported by: 0

README

Simple Template

Install (update) the tmpl command.

$ go get -u github.com/koron/tmpl/cmd/tmpl

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SourceGosrc string

SourceGosrc is a source for LoadGosrc(). Default is "." (current directory)

View Source
var SourceYAML io.Reader

SourceYAML is a source for LoadYAML function. Default is os.Stdin

Functions

func AddFunc

func AddFunc(name string, fn interface{})

AddFunc add a function which can be used from template.

func Execute

func Execute(dataFunc DataFunc, out io.Writer, tmplFiles ...string) error

Execute executes templates set.

If dataFunc is omitted, YAML is loaded by tmpl.LoadYAML

func LoadGosrc

func LoadGosrc() (interface{}, error)

LoadGosrc loads a file or a directory as go source code.

func LoadYAML

func LoadYAML() (interface{}, error)

LoadYAML loads a YAML from SourceYAML.

Types

type DataFunc

type DataFunc func() (interface{}, error)

DataFunc provides data for tmpl.Execute()

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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