emd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: MIT Imports: 6 Imported by: 6

Documentation

Overview

Package emd provides support to process .md files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator generates an emd content.

func NewGenerator

func NewGenerator() *Generator

NewGenerator creates Generator Pointers.

func (*Generator) AddFileTemplate

func (g *Generator) AddFileTemplate(t string) error

AddFileTemplate registers a template file.

func (*Generator) AddFunc

func (g *Generator) AddFunc(name string, f interface{})

AddFunc registers a template function.

func (*Generator) AddFuncs

func (g *Generator) AddFuncs(fm map[string]interface{})

AddFuncs registers a map of template functions.

func (*Generator) AddPostProcess

func (g *Generator) AddPostProcess(f func(string) string)

AddPostProcess registers a post process function. Post process are registered by template func call and are removed after next template generation.

func (*Generator) AddTemplate

func (g *Generator) AddTemplate(t string)

AddTemplate registers a template string.

func (*Generator) Execute

func (g *Generator) Execute(out io.Writer) error

Execute the template to out.

func (*Generator) GetData

func (g *Generator) GetData() map[string]interface{}

GetData returns a copy of the template's data. It is available only during Execute.

func (*Generator) GetKey

func (g *Generator) GetKey(K string) interface{}

GetKey returns value of K.

func (*Generator) GetOut

func (g *Generator) GetOut() io.Writer

GetOut returns the out writer. It is available only during Execute.

func (*Generator) GetSKey

func (g *Generator) GetSKey(K string) string

GetSKey returns a string value of K.

func (*Generator) GetTemplate

func (g *Generator) GetTemplate() *template.Template

GetTemplate returns the compiled templates. It is available only during Execute.

func (*Generator) SetData

func (g *Generator) SetData(name string, d interface{})

SetData registers a template data.

func (*Generator) SetDataMap

func (g *Generator) SetDataMap(dm map[string]interface{})

SetDataMap registers a map of template data.

func (*Generator) WriteString

func (g *Generator) WriteString(s string) (int, error)

WriteString writes a string on out. It is available only during Execute.

Jump to

Keyboard shortcuts

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