Help us shape the future of Go! Take the 2026 Go Developer Survey

jade

package module
v0.0.0-...-c4b662c Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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 (
	// Pretty print if true
	PrettyOutput = true

	// Output indent strring for pretty print
	OutputIndent = "    "

	// Tabulation size of parse file
	TabSize = 4

	// Left go-template delim
	LeftDelim = "{{"

	// Right go-template delim
	RightDelim = "}}"
)

Functions

func Parse

func Parse(name, text string) (string, error)

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>

func ParseFile

func ParseFile(filename string) (string, error)

ParseFile parse the jade template file in given filename

Types

This section is empty.

Directories

Path Synopsis
actions command
jade_extends command
jade_include command

Jump to

Keyboard shortcuts

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