dottmpl

package
v0.0.0-...-d48ffb8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrorName is the name of a node-type error
	ErrorName = dot.ErrorName
	// ErrorID is the ID of of a node of type error
	ErrorID = dot.ErrorID
)

constants borrowed from package `dot`

Variables

This section is empty.

Functions

func Apply

func Apply(data Dot, tmpl Template, name string) (byteS []byte, err error)

Apply template name to data; evaluate name (less Ext) against data as filenameWriteFile into dirPath

func DoIt

func DoIt() error

DoIt performs it all:

  • file system analysis (where to look)
  • collection of metadata from templates
  • execution of all relevant templates

func FileName

func FileName(data Dot, name string) string

FileName resolves name as a template, executed against data

func HaveErrors

func HaveErrors(d *dot.Dot) (*dot.Dot, bool)

HaveErrors returns the subnode with errors nad true, iff any - or nil, false

func Meta

func Meta(text string) (string, error)

Meta returns the meta-text extraced from text

func NewData

func NewData(name string) *dot.Dot

NewData returns a fresh named dot

func SeeError

func SeeError(data *dot.Dot, err error, prefix string) bool

SeeError returns true iff err is non-nil (after registering it)

func Source

func Source(byteS []byte) ([]byte, error)

Source is a wrapper for format.Source

func Write

func Write(data Dot, filename string, byteS []byte) error

Write byteS into dirPath with name resolved against data

Types

type Dot

type Dot interface {
	String() string
	G(keys ...string) *dot.Dot
	Clone() *dot.Dot
	PrintTree(prefix ...string) *dot.Dot

	Fetch(key string) (interface{}, bool) // for ShowErrors
	SeeError(myName, myThing string, err error) bool
}

Dot defines what is used from "container/ccsafe/dot" to register errors

type Template

type Template interface {
	t.Template
}

Template represents the template used (html or text)

func NewTemplate

func NewTemplate(name string) Template

NewTemplate returns a new template with funcmap attached and delimiters set

Jump to

Keyboard shortcuts

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