helpers

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2016 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Helpers = map[string]interface{}{
	"js_escape":   template.JSEscapeString,
	"html_escape": template.HTMLEscapeString,
	"json":        ToJSON,
	"content_for": ContentFor,
	"content_of":  ContentOf,
	"upcase":      strings.ToUpper,
	"downcase":    strings.ToLower,
}

Helpers that are automatically injected into templates.

yield - renders the content of a template into a layout. partial - renders the content of a partial into a template. js_escape - escapes a string to be valid in JavaScript. html_escape - escapes any HTML characters in a string. json - converts the interface to JSON. content_for - stores a block of templating code to be re-used later in the template. content_of - retrieves a stored block for templating and renders it. upcase - strings.ToUpper. downcase - strings.ToLower.

Functions

func ContentFor

func ContentFor(name string, options *raymond.Options) string

ContentFor stores a block of templating code to be re-used later in the template.

{{content_for "buttons"}}
	<button>hi</button>
{{/content_for}}

func ContentOf

func ContentOf(name string, options *raymond.Options) raymond.SafeString

ContentOf retrieves a stored block for templating and renders it.

{{content_of "buttons"}}

func ToJSON

func ToJSON(v interface{}) string

ToJSON converts an interface into a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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