Documentation
¶
Overview ¶
Jade.go - template engine. Package implements Jade-lang templates for generating Go html/template output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TabSize = 4
Functions ¶
func Parse ¶
Parse parses the template definition string to construct a representation of the template for execution.
Trivial usage:
package main
import (
"fmt"
"github.com/Joker/jade"
)
func main() {
tpl, err := jade.Parse("tpl_name", "doctype 5: html: body: p Hello world!")
if err != nil {
fmt.Printf("Parse error: %v", err)
return
}
fmt.Printf( "Output:\n\n%s", tpl )
}
Output:
<!DOCTYPE html><html><body><p>Hello world!</p></body></html>
Types ¶
type CodeNode ¶
type DoctypeNode ¶
func (*DoctypeNode) Copy ¶
func (d *DoctypeNode) Copy() Node
func (*DoctypeNode) String ¶
func (d *DoctypeNode) String() string
func (*DoctypeNode) WriteIn ¶
func (d *DoctypeNode) WriteIn(b io.Writer)
type ListNode ¶
type ListNode struct {
NodeType
Pos
Nodes []Node // The element nodes in lexical order.
// contains filtered or unexported fields
}
ListNode holds a sequence of nodes.
type MixinNode ¶
type Node ¶
type Node interface {
Type() NodeType
String() string
WriteIn(io.Writer)
// Copy does a deep copy of the Node and all its components.
// To avoid type assertions, some XxxNodes also have specialized
// CopyXxx methods that return *XxxNode.
Copy() Node
Position() Pos // byte position of start of node in full original input string
// contains filtered or unexported methods
}
A Node is an element in the parse tree. The interface is trivial. The interface contains an unexported method so that only types local to this package can satisfy it.
type Pos ¶
type Pos int
Pos represents a byte position in the original input text from which this template was parsed.
type TagNode ¶
type TextNode ¶
type Tree ¶
type Tree struct {
Name string // name of the template represented by the tree.
Root *ListNode // top-level root of the tree.
// contains filtered or unexported fields
}
Tree is the representation of a single parsed template.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.