functions

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

All returns all of the templating functions

func First

func First(list interface{}) (interface{}, error)

First returns the head of a list

func GenerateIncludeFn

func GenerateIncludeFn(t *template.Template) func(string, interface{}) (string, error)

GenerateIncludeFn creates a function to be used as an "include" function in templates

func Indent

func Indent(t int, content string) string

Indent prints the given string with the given number of tabs prepended before each line

func IndentSpace

func IndentSpace(t int, content string) string

IndentSpace prints the given string with the given number of spaces prepended before each line

func Last

func Last(list interface{}) (interface{}, error)

Last returns the last item of a list

func Newline

func Newline(c ...int) string

Newline prints a newline (handy for trying to format templates)

func Now

func Now() string

Now returns the current time in the format "2006-01-02T15:04:05Z07:00"

func PadLeft

func PadLeft(n int, s string) string

PadLeft prints the given string in the given number of columns, left aligned

func PadRight

func PadRight(n int, s string) string

PadRight prints the given string in the given number of columns, right aligned

func Rep

func Rep(n int, s ...string) string

Rep repeats the given string(s) the given number of times

func Rest

func Rest(list interface{}) (interface{}, error)

Rest returns the tail of a list

func Space

func Space(n int) string

Space prints a space character the given number of times

func Tab

func Tab(n int) string

Tab prints a tab character the given number of times

func UppercaseFirst

func UppercaseFirst(s string) string

UppercaseFirst converts the first character in a string to uppercase

func WhenEmpty

func WhenEmpty(d, s string) string

WhenEmpty returns the second argument if the first is "empty", otherwise it returns the first

Types

This section is empty.

Jump to

Keyboard shortcuts

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