Documentation ¶
Index ¶
- Variables
- func Add(x, y int) int
- func ConcatenateStrings(tokens ...string) string
- func DateFormat(s string) string
- func DateFormatYYYYMMDD(s string) string
- func DateFormatYYYYMMDDNoSlash(s string) string
- func DatePeriodFormat(s string) string
- func DateTimeFormat(s string) string
- func DateTimeOnsDatePatternFormat(s, lang string) string
- func DomainSetLang(domain string, uri string, language string) string
- func HasField(data interface{}, name string) bool
- func HumanSize(size string) (string, error)
- func InitialiseLocalisationsHelper(assetFn func(name string) ([]byte, error))
- func IntToString(val int) string
- func Last(x int, a interface{}) bool
- func LegacyDatasetDownloadURI(pageURI, filename string) string
- func Localise(key string, language string, plural int, templateArguments ...string) string
- func Loop(n, m int) []int
- func Lower(s string) string
- func Markdown(md string) template.HTML
- func Multiply(x, y int) int
- func NotLastItem(length, index int) bool
- func SafeHTML(s string) template.HTML
- func Slug(s string) string
- func StringArrayContains(s string, items []string) bool
- func Subtract(x, y int) int
- func ThousandsSeparator(i int) string
- func TimeFormat12h(s string) string
- func TimeFormat24h(s string) string
- func TrimPrefixedPeriod(input string) string
- func TruncateToMaximumCharacters(text string, maxLength int) string
Constants ¶
This section is empty.
Variables ¶
var RegisteredFuncs template.FuncMap = template.FuncMap{ "humanSize": HumanSize, "stringArrayContains": StringArrayContains, "safeHTML": SafeHTML, "timeFormat24h": TimeFormat24h, "timeFormat12h": TimeFormat12h, "dateFormat": DateFormat, "dateTimeFormat": DateTimeFormat, "dateFormatYYYYMMDD": DateFormatYYYYMMDD, "dateFormatYYYYMMDDNoSlashes": DateFormatYYYYMMDDNoSlash, "datePeriodFormat": DatePeriodFormat, "dateTimeOnsDatePatternFormat": DateTimeOnsDatePatternFormat, "last": Last, "loop": Loop, "add": Add, "subtract": Subtract, "multiply": Multiply, "slug": Slug, "legacyDatasetDownloadURI": LegacyDatasetDownloadURI, "markdown": Markdown, "localise": Localise, "domainSetLang": DomainSetLang, "hasField": HasField, "notLastItem": NotLastItem, "concatenateStrings": ConcatenateStrings, "truncateToMaximuCharacters": TruncateToMaximumCharacters, "trimPrefixedPeriod": TrimPrefixedPeriod, "intToString": IntToString, "lower": Lower, "thousandsSeparator": ThousandsSeparator, }
Functions ¶
func ConcatenateStrings ¶
ConcatenateStrings takes a number of string arguments and concatenates them
func DateFormat ¶
func DateFormatYYYYMMDD ¶
func DatePeriodFormat ¶
DatePeriodFormat will format a time-series date period string to a human accessible format e.g. "2019 JAN-FEB" to "Jan - Feb 2019" "2010 Q1" to "Jan - Mar 2010"
func DateTimeFormat ¶
func InitialiseLocalisationsHelper ¶
InitialiseLocalisationsHelper sets up the core and service specific localisations for use in the templates with the Localise helper function
func LegacyDatasetDownloadURI ¶
LegacyDataSetDownloadURI builds a URI string for a legacy dataset download URI.
func NotLastItem ¶
NotLastItem returns true/false based on if the index equals the length Example of use is in JSON-LD partials, where we must determine whether or not a comma should be rendered in a range
func StringArrayContains ¶
func ThousandsSeparator ¶
func TimeFormat12h ¶
TimeForma12h extracts time value for 12hr clock from ISO8601 formatted timestamps
func TimeFormat24h ¶
TimeFormat24h extracts time value for 24hr clock from ISO8601 formatted timestamps
func TrimPrefixedPeriod ¶
TrimPrefixedPeriod remove prefixed periods from the start of the string
func TruncateToMaximumCharacters ¶
TruncateToMaximumCharacters returns a substring of parameter 'text' if the text is longer than the specified maximum length
Types ¶
This section is empty.
Source Files ¶
- add.go
- concatenate_strings.go
- date_format.go
- date_period_format.go
- domain_set_lang.go
- has_field.go
- human_size.go
- int_to_string.go
- last.go
- legacy_dataset_download_uri.go
- localise.go
- loop.go
- lower.go
- markdown.go
- multiply.go
- not_last_item.go
- registered_functions.go
- safe_html.go
- slug.go
- string_array_contains.go
- subtract.go
- thousand_separator.go
- trim_prefixed_period.go
- truncate_to_maximum_characters.go