pug
This package was originally written by eknkc. This package contains some fixes and modifications.
import "github.com/knaka/pug"
Package pug.go is an elegant templating engine for Go Programming Language.
It is a port of Pug template engine, previously known as Jade.
Pug.go compiles .pug templates to standard go templates (https://golang.org/pkg/html/template/) and returns a *template.Template
instance.
While there is no JavaScript environment present, Pug.go provides basic expression support over go template syntax. Such as a(href="/user/" + UserId)
would concatenate two strings. You can use arithmetic, logical and comparison operators as well as ternery if operator.
Please check Pug Language Reference for details: https://pugjs.org/api/getting-started.html.
Differences between Pug and Pug.go (items with checkboxes are planned, just not present yet)
Apart from these missing features, everything in the language reference should be supported.
- Fixed support for class names with '-'
- Fixed nested loops
- Added support for single quotes
- Added support for import exception list
doc.go pug.go
func CompileFile(filename string, options ...Options) (*template.Template, error)
Parses and compiles the contents of supplied filename. Returns corresponding Go Template (html/templates) instance.
Necessary runtime functions will be injected and the template will be ready to be executed
func CompileString(input string, options ...Options) (*template.Template, error)
Parses and compiles the supplied template string. Returns corresponding Go Template (html/templates) instance.
Necessary runtime functions will be injected and the template will be ready to be executed
func ParseFile(filename string, options ...Options) (string, error)
Parses the contents of supplied filename template and return the Go Template source You would not be using this unless debugging / checking the output.
Please use Compile method to obtain a template instance directly
func ParseString(input string, options ...Options) (string, error)
Parses the supplied template string and return the Go Template source You would not be using this unless debugging / checking the output.
Please use Compile method to obtain a template instance directly
type Options struct {
PrettyPrint bool
Dir compiler.Dir
}
Generated by godoc2md