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 DatePeriodFormat(s 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 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 Markdown(md string) template.HTML
- func NotLastItem(length, index int) bool
- func SafeHTML(s string) template.HTML
- func Slug(s string) string
- func Subtract(x, y int) int
- func TruncateToMaximumCharacters(text string, maxLength int) string
Constants ¶
This section is empty.
Variables ¶
var RegisteredFuncs template.FuncMap = template.FuncMap{ "humanSize": HumanSize, "safeHTML": SafeHTML, "dateFormat": DateFormat, "dateFormatYYYYMMDD": DateFormatYYYYMMDD, "datePeriodFormat": DatePeriodFormat, "last": Last, "loop": Loop, "subtract": Subtract, "slug": Slug, "legacyDatasetDownloadURI": LegacyDatasetDownloadURI, "markdown": Markdown, "localise": Localise, "domainSetLang": DomainSetLang, "hasField": HasField, "notLastItem": NotLastItem, "concatenateStrings": ConcatenateStrings, "truncateToMaximuCharacters": TruncateToMaximumCharacters, }
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 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 TruncateToMaximumCharacters ¶
TruncateToMaximumCharacters returns a substring of parameter 'text' if the text is longer than the specified maximum length
Types ¶
This section is empty.