templates

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2016 License: AGPL-3.0, AGPL-3.0-or-later Imports: 17 Imported by: 0

Documentation

Overview

Package templates generates and stores HTML templates

Index

Constants

This section is empty.

Variables

View Source
var (
	// TemplateRoot stores the root directory of all HTML templates. Overridden
	// in tests.
	TemplateRoot = "templates"
)

Functions

func Board added in v2.7.0

func Board(b string, data *types.Board) ([]byte, error)

Board renders board page HTML for noscript browsers

func Compile

func Compile() error

Compile reads template HTML from disk, injects dynamic variables, hashes and stores them

func ParseTemplates added in v2.7.0

func ParseTemplates() error

ParseTemplates reads all HTML templates from disk, strips whitespace and parses them into the global template map

func Set

func Set(name string, s Store)

Set sets a template to the specified value. Only use in tests.

func Thread added in v2.7.0

func Thread(t *types.Thread) ([]byte, error)

Thread renders thread page HTML for noscript browsers

Types

type Store

type Store struct {
	HTML []byte
	Hash string
}

Store stores the compiled HTML template and the corresponding truncated MD5 hash of said template

func Get

func Get(name string) Store

Get retrieves a compiled template by its name

Jump to

Keyboard shortcuts

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