Documentation
¶
Overview ¶
Jade.go - template engine. Package implements Jade-lang templates for generating Go html/template output.
Index ¶
- Variables
- func Config(c ReplaseTokens)
- func New(name string) *tree
- func Parse(fname string, text []byte) (string, error)
- func ParseFile(fname string) (string, error)
- func ParseFileFromFileSystem(fname string, fs http.FileSystem) (str string, err error)
- func ParseWithFileSystem(fname string, text []byte, fs http.FileSystem) (str string, err error)
- func UseGoFilter() *goFilter
- type ReplaseTokens
Constants ¶
This section is empty.
Variables ¶
View Source
var ReadFunc = ioutil.ReadFile
View Source
var TabSize = 4
Functions ¶
func Config ¶ added in v1.1.0
func Config(c ReplaseTokens)
func Parse ¶
Parse parses the template definition string to construct a representation of the template for execution.
Trivial usage:
package main
import (
"fmt"
"html/template"
"net/http"
"github.com/Joker/jade"
)
func handler(w http.ResponseWriter, r *http.Request) {
jadeTpl, _ := jade.Parse("jade", []byte("doctype 5\n html: body: p Hello #{.Word}!"))
goTpl, _ := template.New("html").Parse(jadeTpl)
goTpl.Execute(w, struct{ Word string }{"jade"})
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
Output:
<!DOCTYPE html><html><body><p>Hello jade!</p></body></html>
func ParseFileFromFileSystem ¶ added in v1.1.2
func ParseFileFromFileSystem(fname string, fs http.FileSystem) (str string, err error)
ParseFileFromFileSystem parse template file in context of a http.FileSystem (supports embedded files)
func ParseWithFileSystem ¶ added in v1.1.2
ParseWithFileSystem parse in context of a http.FileSystem (supports embedded files)
Types ¶
type ReplaseTokens ¶ added in v1.1.0
type ReplaseTokens 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
}
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.
