template

package
v0.0.0-...-a7141ec Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2014 License: AGPL-3.0-or-later, AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package template implements template rendering services for Monsti and Monsti content worker types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context map[string]interface{}

Context can be used to define a context for Render.

type Renderer

type Renderer struct {
	// Root is the absolute path to the template directory.
	Root string
}

A Renderer for mustache templates.

func (Renderer) Render

func (r Renderer) Render(name string, context interface{},
	locale string, siteTemplates string) (string, error)

Render the named template with given context.

name is the name of the template (e.g. "blocks/sidebar"). context is used as template context for rendering. locale is the locale to use for translation strings in templates. siteTemplates is the path to the site's overridden templates. If it's an empty string, Render will not search for overridden templates.

Render searches for nested templates to include in these files: <dir_of_template>/<template>.include <dir_of_template>/include <any_parent_dir_of_template>/include

Returns the rendered template.

Jump to

Keyboard shortcuts

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