unitemplate

package module
v0.0.0-...-428fbb4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2013 License: BSD-2-Clause Imports: 13 Imported by: 0

README

unitemplate

Unitemplate is a library for executing templates written in multiple formats cooperatively. For instance, a mustache template might call a template written in a haml-ish languages, and the result would get inserted into a block from a django style template.

The reason this works is that each format is supported by creating a parser for that format that ouputs a number of Tree structs from Go's text/template/parse library. Each Tree is then combined into into a html/template and text/template template, so when you execute the Engine instance, you can have either an html escaped form or a plain text form.

Documentation

Current Formats:

  • None

Formats in Testing:

  • Mustache

Formats in Progress:

  • Haml-ish
  • Django-ish

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterParser

func RegisterParser(p Parser)

func RegisterParsers

func RegisterParsers(parsers ...Parser)

Types

type Parser

type Parser interface {
	ParseFile(name, content string) (map[string]*parse.Tree, error)
	RequiredHtmlFuncs() htmlTemplate.FuncMap
	RequiredTextFuncs() textTemplate.FuncMap
	ApplicableExtensions() []string
}

type Template

type Template struct {
	HtmlItem *htmlTemplate.Template
	TextItem *textTemplate.Template
	Parent   *TemplateLoader
}

type TemplateLoader

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

func NewTemplateLoader

func NewTemplateLoader(viewPaths, layoutPaths []string) (*TemplateLoader, error)

func (*TemplateLoader) Lookup

func (tl *TemplateLoader) Lookup(name string) (Template, bool)

func (*TemplateLoader) Refresh

func (tl *TemplateLoader) Refresh() error

type TemplateResult

type TemplateResult struct {
	Page, Layout uni.Template
	RenderArgs   map[string]interface{}
	RenderTmpl   map[string]Template
}

func (*TemplateResult) Apply

func (r *TemplateResult) Apply(req *revel.Request, resp *revel.Response)

Directories

Path Synopsis
app
bham or the "blocky hypertext abstraction markup" is an attempt to take what is good about languages like haml, jade, slim, etc.
bham or the "blocky hypertext abstraction markup" is an attempt to take what is good about languages like haml, jade, slim, etc.

Jump to

Keyboard shortcuts

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