templatepipe

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2015 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base

func Base(filename string, opts *ace.Options) string

Base returns filepath.Base'd filename sans extension if it matches opts.Extension.

func Curl

func Curl(s string) string

func CurlyNotMethod

func CurlyNotMethod(parent, key, full string) interface{}

func CurlyX

func CurlyX(parent, key, full string) interface{}

func Data

func Data(cf CurlyFunc, root *template.Template) interface{}

func Encurl

func Encurl(cf CurlyFunc, parent Dotted, level int) interface{}

Encurl returns constructed Nota.

func Format

func Format(prettyprint bool, input string, noclose []string) (output string)

Format pretty-formats html unless prettyprint if false.

func FormatSubtrees

func FormatSubtrees(prettyprint bool, tpl *templatehtml.Template, noclose []string) (output string)

FormatSubtrees returns subtemplates trees forrmatted.

func LoadAce

func LoadAce(base AceFile, inner *AceFile, innername string, opts *ace.Options) (*templatehtml.Template, error)

LoadAce is ace.Load without dealing with includes and setting Base'd names for the templates.

func Main

func Main(htmlFuncs, jsxlFuncs map[string]interface{})

func Uncurl

func Uncurl(s string) string

func WriteFile

func WriteFile(filename, data string) error

WriteFile is ioutil.WriteFile if filename is not "", otherwise it's as if filename was /dev/stdout.

Types

type AceFile

type AceFile struct {
	*ace.File
	Basename string
}

func NewAceFile

func NewAceFile(filename string, content []byte, opts *ace.Options) (AceFile, error)

NewAce returns *ace.File: may read filename if content is nil. Ace will know the file by base name.

type Context

type Context struct {
	Dotted Dotted              // end result
	Vars   map[string][]string // for vars kept between Node* methods calls
}

func (*Context) Node

func (c *Context) Node(node parse.Node, na NodeArgs)

func (*Context) Ranging

func (c *Context) Ranging(rangeNode *parse.RangeNode, na NodeArgs)

func (*Context) Touch

func (c *Context) Touch(na NodeArgs, words []string)

type Curled

type Curled string

func Curly

func Curly(parent, key, full string) Curled

func (Curled) Uncurl

func (c Curled) Uncurl() string

type CurlyFunc

type CurlyFunc func(string, string, string) interface{}

type Define

type Define struct {
	ShortName  string
	Iterable   string
	NeedList   bool
	UsesParams bool
	JSX        string
}

func MakeDefine

func MakeDefine(definesonly *templatetext.Template, shortname, fullname string) (Define, error)

type Dotted

type Dotted struct {
	Parent *Dotted
	Leaves []*Dotted // template/parse has nodes, we ought to have leaves
	Name   string

	Ranged bool
	Keys   []string
	Decl   string
}

Dotted is a tree.

func (*Dotted) Append

func (d *Dotted) Append(words []string, prefix []string) *Dotted

Append adds words into d.

func (*Dotted) Find

func (d *Dotted) Find(words []string) *Dotted

Find traverses d to search by words. Used by tests.

func (Dotted) Leave

func (d Dotted) Leave(name string) *Dotted

func (*Dotted) Notation

func (d *Dotted) Notation() (string, string, string)

type NodeArgs

type NodeArgs struct {
	Template    *template.Template
	PrefixWords []string
	Decl        []*parse.VariableNode
}

type Nota

type Nota map[string]interface{}

Nota is a type of encoded jsx notations for template transplitting.

func (Nota) String

func (n Nota) String() string

func (Nota) Uncurl

func (n Nota) Uncurl() string

Uncurl is required by templatefunc.Uncurler interface.

type SortableTemplates

type SortableTemplates []*templatehtml.Template

SortableTemplates is for just sorting.

func (SortableTemplates) Len

func (st SortableTemplates) Len() int

func (SortableTemplates) Less

func (st SortableTemplates) Less(i, j int) bool

func (SortableTemplates) Swap

func (st SortableTemplates) Swap(i, j int)

Jump to

Keyboard shortcuts

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