docs: Regenerate docs helper
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 8 Jun 2021 16:52:38 +0000 (18:52 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 8 Jun 2021 16:52:38 +0000 (18:52 +0200)
docs/data/docs.json
tpl/fmt/fmt.go

index 5e27712e361120129884e5dbf0615fc5b831dc82..2b17ad8af2437fe8bb72649dac5e9bceeafed1b0 100644 (file)
             [
               "\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"
+            ],
+            [
+              "{{ slice \"foo\" 1 \"bar\" 2 | querify | safeHTML }}",
+              "bar=2\u0026foo=1"
             ]
           ]
         },
           "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": [
             "sep",
-            "urlParts"
+            "args"
           ],
           "Aliases": [
             "getCSV"
         "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.",
           "Args": [
-            "urlParts"
+            "args"
           ],
           "Aliases": [
             "getJSON"
             ]
           ]
         },
+        "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": {
           "Description": "Print returns string representation of the passed arguments.",
           "Args": [
             ]
           ]
         },
+        "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": {
           "Description": "Mod returns a % b.",
           "Args": [
           ]
         },
         "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": [
             "a"
           ],
index 9c16ca6564c8a0918c5d942ea157126d0bf2eb49..cb8aa3cf29fb528eb833215b3596ab371c14ca0d 100644 (file)
@@ -25,7 +25,11 @@ import (
 
 // New returns a new instance of the fmt-namespaced template functions.
 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)
        ns := &Namespace{
                distinctLogger: ignorableLogger.Apply(distinctLogger),