tmpl

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tmpl provides templating functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Name string
	Text string
}

Item represents a named templated which can reference other named templated too

type Template

type Template struct {
	Items []*Item
	// contains filtered or unexported fields
}

Template represents a new Template with given name and content to be rendered with provided settings with use of built-in and custom functions

func NewTemplate

func NewTemplate(items ...*Item) *Template

NewTemplate returns new instance of Template

func (*Template) CustomFunc

func (t *Template) CustomFunc(funcs template.FuncMap)

CustomFunc adds new custom functions to the template if functions with the same names didn't exist

func (*Template) Render

func (t *Template) Render(module *tfconf.Module) (string, error)

Render renders the Template with given Module struct

func (*Template) Settings

func (t *Template) Settings(settings *print.Settings)

Settings adds current user-selected settings to the Template

Jump to

Keyboard shortcuts

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