gofilters

package module
v0.0.0-...-b8fab24 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSlashes

func AddSlashes(value string) string

AddSlashes adds slashes before quotes. Useful for escaping strings in CSV, for example. Less useful for escaping JavaScript; use the “escapejs“ filter instead.

func CapFirst

func CapFirst(value string) string

CapFirst capitalizes the first character of the value.

func Cut

func Cut(value string, arg string) string

Cut removes all values of a certain string from the input.

func Date

func Date(value string, format string) string

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

func DictSort(value []map[string]string, arg string) []map[string]string

DictSort takes a list of dictionaries and returns that list sorted by the key given in the argument.

func DictSortReversed

func DictSortReversed(value []map[string]string, arg string) []map[string]string

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

func FloatFormat(text float64, arg int) string

FloatFormat displays a float to a specified number of decimal places.

func IreEncode

func IreEncode(value string) string

IreEncode encodes a string as a quoted-printable string.

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

func LineNumbers(value string, autoescape bool) string

LineNumbers displays text with line numbers.

func Lower

func Lower(value string) string

Lower converts a string into all lowercase.

func Pluralize

func Pluralize(size int, word string, arg ...string) string

Pluralize returns a plural suffix if the value is not 1, '1', or an object of

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

func Slugify(value string) string

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

func TimeSince(value string) string

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

func TimeUntil(value string) string

TimeUntil returns the time until the given date. Format a date as the time until that date (i.e. "4 days, 6 hours").

func Title

func Title(value string) string

Title converts a string into titlecase.

func Truncatechars

func Truncatechars(value string, arg int) string

Truncatechars truncates a string after a certain number of characters.

func Truncatewords

func Truncatewords(value string, arg int) string

Truncatewords truncates a string after a certain number of words.

func URLEncode

func URLEncode(value string) string

URLEncode encodes a string as a quoted-printable string.

func Upper

func Upper(value string) string

Upper converts a string into all uppercase.

func Wordcount

func Wordcount(value string) int

Wordcount returns the number of words in a string.

func Wordwrap

func Wordwrap(value string, arg int) string

Wordwrap wraps a string after a certain number of characters.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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