docs: Regenerate docs helper

This commit is contained in:
Bjørn Erik Pedersen 2021-06-08 18:52:38 +02:00
parent 162f41d0ef
commit a91cd7652f
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 57 additions and 4 deletions

View file

@ -3144,6 +3144,10 @@
[ [
"\u003ca href=\"https://www.google.com?{{ (querify \"q\" \"test\" \"page\" 3) | safeURL }}\"\u003eSearch\u003c/a\u003e", "\u003ca href=\"https://www.google.com?{{ (querify \"q\" \"test\" \"page\" 3) | safeURL }}\"\u003eSearch\u003c/a\u003e",
"\u003ca href=\"https://www.google.com?page=3\u0026amp;q=test\"\u003eSearch\u003c/a\u003e" "\u003ca href=\"https://www.google.com?page=3\u0026amp;q=test\"\u003eSearch\u003c/a\u003e"
],
[
"{{ slice \"foo\" 1 \"bar\" 2 | querify | safeHTML }}",
"bar=2\u0026foo=1"
] ]
] ]
}, },
@ -3337,7 +3341,7 @@
"Description": "GetCSV expects a data separator and one or n-parts of a URL to a resource which\ncan either be a local or a remote one.\nThe data separator can be a comma, semi-colon, pipe, etc, but only one character.\nIf you provide multiple parts for the URL they will be joined together to the final URL.\nGetCSV returns nil or a slice slice to use in a short code.", "Description": "GetCSV expects a data separator and one or n-parts of a URL to a resource which\ncan either be a local or a remote one.\nThe data separator can be a comma, semi-colon, pipe, etc, but only one character.\nIf you provide multiple parts for the URL they will be joined together to the final URL.\nGetCSV returns nil or a slice slice to use in a short code.",
"Args": [ "Args": [
"sep", "sep",
"urlParts" "args"
], ],
"Aliases": [ "Aliases": [
"getCSV" "getCSV"
@ -3347,7 +3351,7 @@
"GetJSON": { "GetJSON": {
"Description": "GetJSON expects one or n-parts of a URL to a resource which can either be a local or a remote one.\nIf you provide multiple parts they will be joined together to the final URL.\nGetJSON returns nil or parsed JSON to use in a short code.", "Description": "GetJSON expects one or n-parts of a URL to a resource which can either be a local or a remote one.\nIf you provide multiple parts they will be joined together to the final URL.\nGetJSON returns nil or parsed JSON to use in a short code.",
"Args": [ "Args": [
"urlParts" "args"
], ],
"Aliases": [ "Aliases": [
"getJSON" "getJSON"
@ -3442,6 +3446,23 @@
] ]
] ]
}, },
"Erroridf": {
"Description": "Erroridf formats according to a format specifier and logs an ERROR and\nan information text that the error with the given ID can be suppressed in config.\nIt returns an empty string.",
"Args": [
"id",
"format",
"a"
],
"Aliases": [
"erroridf"
],
"Examples": [
[
"{{ erroridf \"my-err-id\" \"%s.\" \"failed\" }}",
""
]
]
},
"Print": { "Print": {
"Description": "Print returns string representation of the passed arguments.", "Description": "Print returns string representation of the passed arguments.",
"Args": [ "Args": [
@ -3829,6 +3850,34 @@
] ]
] ]
}, },
"Max": {
"Description": "Max returns the greater of two numbers.",
"Args": [
"a",
"b"
],
"Aliases": null,
"Examples": [
[
"{{math.Max 1 2 }}",
"2"
]
]
},
"Min": {
"Description": "Min returns the smaller of two numbers.",
"Args": [
"a",
"b"
],
"Aliases": null,
"Examples": [
[
"{{math.Min 1 2 }}",
"1"
]
]
},
"Mod": { "Mod": {
"Description": "Mod returns a % b.", "Description": "Mod returns a % b.",
"Args": [ "Args": [
@ -3907,7 +3956,7 @@
] ]
}, },
"Sqrt": { "Sqrt": {
"Description": "Sqrt returns the square root of a number.\nNOTE: will return for NaN for negative values of a", "Description": "Sqrt returns the square root of a number.",
"Args": [ "Args": [
"a" "a"
], ],

View file

@ -25,7 +25,11 @@ import (
// New returns a new instance of the fmt-namespaced template functions. // New returns a new instance of the fmt-namespaced template functions.
func New(d *deps.Deps) *Namespace { func New(d *deps.Deps) *Namespace {
ignorableLogger := d.Log.(loggers.IgnorableLogger) ignorableLogger, ok := d.Log.(loggers.IgnorableLogger)
if !ok {
ignorableLogger = loggers.NewIgnorableLogger(d.Log)
}
distinctLogger := helpers.NewDistinctLogger(d.Log) distinctLogger := helpers.NewDistinctLogger(d.Log)
ns := &Namespace{ ns := &Namespace{
distinctLogger: ignorableLogger.Apply(distinctLogger), distinctLogger: ignorableLogger.Apply(distinctLogger),