Documentation
¶
Overview ¶
Jade.go - template engine. Package implements Jade-lang templates for generating Go html/template output.
Index ¶
- Variables
- func Config(c Cfg)
- func ConfigOtputPHP()
- func Parse(name string, text []byte) (string, error)
- func ParseFile(filename string) (string, error)
- type BlockNode
- type Cfg
- type CodeNode
- type CondNode
- type DoctypeNode
- type ListNode
- type MixinNode
- type Node
- type NodeType
- type Out
- type Pos
- type TagNode
- type TextNode
- type Tree
Constants ¶
This section is empty.
Variables ¶
View Source
var TabSize = 4
Functions ¶
func ConfigOtputPHP ¶
func ConfigOtputPHP()
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/iris-contrib/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 Cfg ¶
type Cfg struct {
GolangMode bool
TagBgn string
TagEnd string
TagVoid string
TagArgEsc string
TagArgUne string
TagArgStr string
TagArgAdd string
TagArgBgn string
TagArgEnd string
CondIf string
CondUnless string
CondCase string
CondWhile string
CondFor string
CondEnd string
CondForIf string
CodeForElse string
CodeLongcode string
CodeBuffered string
CodeUnescaped string
CodeElse string
CodeElseIf string
CodeCaseWhen string
CodeCaseDef string
CodeMixBlock string
TextStr string
TextComment string
MixinBgn string
MixinEnd string
MixinVarBgn string
MixinVar string
MixinVarRest string
MixinVarEnd string
MixinVarBlockBgn string
MixinVarBlock string
MixinVarBlockEnd string
}
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.
// ReadFunc is used to read files that are required when parsing a template (e.g. extends $file).
// Set to a custom reader to override the default behavior from reading by system directory.
//
// See https://github.com/kataras/iris/issues/1450.
ReadFunc func(path string) ([]byte, error)
Root *ListNode // top-level root of the tree.
// contains filtered or unexported fields
}
Tree is the representation of a single parsed template.
func NewWithReadFunc ¶
NewWithReadFunc same as `New` but it overrides the template's contents reader.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
jade
command
|
|
|
Code generated by "jade.go"; DO NOT EDIT.
|
Code generated by "jade.go"; DO NOT EDIT. |
|
v1.0
command
|
|
|
v1.0/actions
command
|
|
|
v1.0/jade_extends
command
|
|
|
v1.0/jade_include
command
|
Click to show internal directories.
Click to hide internal directories.