mussed

package module
v0.0.0-...-06e70d7 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2013 License: BSD-2-Clause Imports: 12 Imported by: 0

README

mussed

Mussed is a nearly mustache template library that maps to text/template/parse Trees instead of being a complete template library.

Divergences from Mustache

  • Quote characters are escaped with the Code instead of the Entity Name
  • Templates that aren't found are treated as fatal errors instead of empty strings
  • On the third partials test, Go is more proactive than mustache and escaped '<'s where an average mustache would not
  • Partials do not inherit the indentation of their caller, this was found on partial specs 7-9.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LeftDelim        = "{{"
	RightDelim       = "}}"
	LeftEscapeDelim  = "{{{"
	RightEscapeDelim = "}}}"
)
View Source
var RequiredFuncs = template.FuncMap{
	"mussedIsCollection": func(i interface{}) bool {
		it := reflect.TypeOf(i)
		switch it.Kind() {
		case reflect.Array, reflect.Slice:
			return true
		default:
			return false
		}
	},
	"mussedUnescape": func(i ...interface{}) template.HTML {
		if len(i) == 1 {
			return template.HTML(fmt.Sprint(i[0]))
		}
		return template.HTML("")
	},
	"mussedUpscope":   upscope,
	"mussedDownscope": downscope,
}

Functions

func Parse

func Parse(templateName, templateContent string) (map[string]*parse.Tree, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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