Documentation
¶
Index ¶
- func AddSlashes(value string) string
- func CapFirst(value string) string
- func Cut(value string, arg string) string
- func Date(value string, format string) string
- func DefaultIfNone(value interface{}, arg string) interface{}
- func DictSort(value []map[string]string, arg string) []map[string]string
- func DictSortReversed(value []map[string]string, arg string) []map[string]string
- func FirstItem(value interface{}) interface{}
- func FloatFormat(text float64, arg int) string
- func IreEncode(value string) string
- func LastItem(value interface{}) interface{}
- func LineNumbers(value string, autoescape bool) string
- func Lower(value string) string
- func Pluralize(size int, word string, arg ...string) string
- func RandomItem(value interface{}) interface{}
- func Slugify(value string) string
- func TimeSince(value string) string
- func TimeUntil(value string) string
- func Title(value string) string
- func Truncatechars(value string, arg int) string
- func Truncatewords(value string, arg int) string
- func URLEncode(value string) string
- func Upper(value string) string
- func Wordcount(value string) int
- func Wordwrap(value string, arg int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSlashes ¶
AddSlashes adds slashes before quotes. Useful for escaping strings in CSV, for example. Less useful for escaping JavaScript; use the “escapejs“ filter instead.
func Date ¶
Date formats a date according to the given format. The format is like PHP's date function format.
func DefaultIfNone ¶
func DefaultIfNone(value interface{}, arg string) interface{}
DefaultIfNone returns the value if it is not None, otherwise returns the default value. value can be a string or an object.
func DictSort ¶
DictSort takes a list of dictionaries and returns that list sorted by the key given in the argument.
func DictSortReversed ¶
DictSortReversed takes a list of dictionaries and returns that list sorted by the key given in the argument in reverse order.
func FirstItem ¶
func FirstItem(value interface{}) interface{}
FirstItem returns the first item in a list, can by a list of int or string
func FloatFormat ¶
FloatFormat displays a float to a specified number of decimal places.
func LastItem ¶
func LastItem(value interface{}) interface{}
LastItem returns the last item in a list, can by a list of int or string
func LineNumbers ¶
LineNumbers displays text with line numbers.
func RandomItem ¶
func RandomItem(value interface{}) interface{}
RandomItem returns a random item from the list, can by a list of int or string
func Slugify ¶
Slugify converts a string into a slug. A slug is a string where spaces and special characters are replaced by a hyphen, suitable for use in a URL.
func TimeSince ¶
TimeSince returns the time since the given date. Format a date as the time since that date (i.e. "4 days, 6 hours").
func TimeUntil ¶
TimeUntil returns the time until the given date. Format a date as the time until that date (i.e. "4 days, 6 hours").
func Truncatechars ¶
Truncatechars truncates a string after a certain number of characters.
func Truncatewords ¶
Truncatewords truncates a string after a certain number of words.
Types ¶
This section is empty.