Documentation ¶
Index ¶
- func Dictionary(values ...interface{}) (map[string]interface{}, error)
- func MsToSeconds(value interface{}) string
- func NaturalTime(d time.Time) string
- func NumComma(value interface{}) string
- func OrdToSuffix(value interface{}) string
- func Plural(value interface{}, singular string, plural string) string
- func PluralWord(value interface{}, singular string, plural string) string
- func RFCTime(d time.Time) string
- func SiSuffix(value interface{}) string
- func Trunc(s string, i int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dictionary ¶
Dictionary creates a map[string]interface{} from the given parameters by walking the parameters and treating them as key-value pairs. The number of parameters must be even.
Copyright The Hugo Authors License Apache 2 https://github.com/spf13/hugo/blob/master/LICENSE.md https://github.com/spf13/hugo/blob/master/tpl/template_funcs.go
func MsToSeconds ¶ added in v1.0.3
func MsToSeconds(value interface{}) string
MsToSeconds converts a time in milliseconds to a representation in seconds. i.e. 147 milliseconds = 0.147
func NaturalTime ¶
NaturalTime converts a time into a moment relative to now in human terms. i.e. `12 secondds ago` or `3 days from now`
func NumComma ¶
func NumComma(value interface{}) string
NumComma takes a number and returns it comma delimited
If the value provided is not a number, an empty string is returned
func OrdToSuffix ¶
func OrdToSuffix(value interface{}) string
OrdToSuffix takes an int, int32 or int64 and returns an nth English suffix
func Plural ¶ added in v1.0.2
Plural takes a number and a singular word and pluralises using basic English rules. If the output is not as expected, provide the plural word too.
e.g. Plural(17, "record", "") = 17 records
func PluralWord ¶ added in v1.0.2
PluralWord takes a number and a singular word and pluralises using basic English rules. If the output is not as expected, provide the plural word too.
e.g. PluralWord(17, "record", "") = records
func RFCTime ¶
RFCTime converts a time into the RFC3339 representation of that time for use in a HTML5 time element.
Types ¶
This section is empty.