]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tpl: Add missing functions to init files
authorJoe Mooring <joe@mooring.com>
Sat, 13 Dec 2025 17:32:26 +0000 (09:32 -0800)
committerGitHub <noreply@github.com>
Sat, 13 Dec 2025 17:32:26 +0000 (18:32 +0100)
Closes #14249

24 files changed:
docs/data/docs.yaml
tpl/cast/init.go
tpl/collections/init.go
tpl/compare/init.go
tpl/crypto/init.go
tpl/css/css.go
tpl/data/init.go
tpl/debug/init.go
tpl/diagrams/init.go
tpl/fmt/init.go
tpl/hash/hash.go
tpl/images/init.go
tpl/js/init.go
tpl/lang/init.go
tpl/math/init.go
tpl/os/init.go
tpl/partials/init.go
tpl/path/init.go
tpl/resources/init.go
tpl/strings/init.go
tpl/templates/init.go
tpl/time/init.go
tpl/transform/init.go
tpl/urls/init.go

index 40b701d9ba165b5aabb6172b6c3b25008b0dfeb8..75daaf6ac0379d7e6760e7e0223f1e6efcbe9688 100644 (file)
@@ -1499,7 +1499,6 @@ config:
     tdewolff:
       css:
         inline: false
-        keepCSS2: false
         precision: 0
         version: 0
       html:
@@ -1522,7 +1521,6 @@ config:
         keepNumbers: false
         precision: 0
       svg:
-        inline: false
         keepComments: false
         precision: 0
       xml:
@@ -1891,7 +1889,7 @@ config:
       disable: false
     googleAnalytics:
       disable: false
-      respectDoNotTrack: false
+      respectDoNotTrack: true
     instagram:
       disable: false
       simple: false
@@ -2174,9 +2172,12 @@ tpl:
           - '[a f]'
       D:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - seed
+        - 'n'
+        - hi
+        Description: 'D returns a sorted slice of unique random integers in the half-open interval\n[0, hi) using the provided seed value. The number of elements in the\nresulting slice is n or hi, whichever is less.\n\nIf n <= hi, it returns a sorted random sample of size n using J. S. Vitter’s\nMethod D for sequential random sampling.\n\nIf n > hi, it returns the full, sorted range [0, hi) of size hi.\n\nIf n == 0 or hi == 0, it returns an empty slice.\n\nReference:\n\n\tJ. S. Vitter, "An efficient algorithm for sequential random sampling," ACM Trans. Math. Softw., vol. 11, no. 1, pp. 37–57, 1985.\n\tSee also: https://getkerf.wordpress.com/2016/03/30/the-best-algorithm-no-one-knows-about/'
+        Examples: []
       Delimit:
         Aliases:
         - delimit
@@ -2327,9 +2328,10 @@ tpl:
           - bar=2&foo=1
       Reverse:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - l
+        Description: Reverse creates a copy of the list l and reverses it.
+        Examples: []
       Seq:
         Aliases:
         - seq
@@ -2495,9 +2497,15 @@ tpl:
         Examples: []
       LtCollate:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - collator
+        - first
+        - others
+        Description: |-
+          LtCollate returns the boolean truth of arg1 < arg2 && arg1 < arg3 && arg1 < arg4.
+          The provided collator will be used for string comparisons.
+          This is for internal use.
+        Examples: []
       Ne:
         Aliases:
         - ne
@@ -2509,9 +2517,10 @@ tpl:
     crypto:
       FNV32a:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - v
+        Description: 'FNV32a hashes v using fnv32a algorithm.\n<docsmeta>{"newIn": "0.98.0" }</docsmeta>'
+        Examples: []
       HMAC:
         Aliases:
         - hmac
@@ -2563,9 +2572,10 @@ tpl:
         Examples: []
       Quoted:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - v
+        Description: Quoted returns a string that needs to be quoted in CSS.
+        Examples: []
       Sass:
         Aliases:
         - toCSS
@@ -2575,14 +2585,16 @@ tpl:
         Examples: []
       TailwindCSS:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - args
+        Description: TailwindCSS processes the given Resource with tailwindcss.
+        Examples: []
       Unquoted:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - v
+        Description: Unquoted returns a string that does not need to be quoted in CSS.
+        Examples: []
     data:
       GetCSV:
         Aliases:
@@ -2627,35 +2639,44 @@ tpl:
           - '{\n  "Hugo": "Rocks!"\n}'
       TestDeprecationErr:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - item
+        - alternative
+        Description: Internal template func, used in tests only.
+        Examples: []
       TestDeprecationInfo:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - item
+        - alternative
+        Description: Internal template func, used in tests only.
+        Examples: []
       TestDeprecationWarn:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - item
+        - alternative
+        Description: Internal template func, used in tests only.
+        Examples: []
       Timer:
         Aliases: null
-        Args: null
+        Args:
+        - name
         Description: ''
-        Examples: null
+        Examples: []
       VisualizeSpaces:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - val
+        Description: VisualizeSpaces returns a string with spaces replaced by a visible string.
+        Examples: []
     diagrams:
       Goat:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - v
+        Description: Goat creates a new SVG diagram from input v.
+        Examples: []
     encoding:
       Base64Decode:
         Aliases:
@@ -2722,9 +2743,12 @@ tpl:
           - ''
       Errormf:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - m
+        - format
+        - args
+        Description: Errormf is experimental and subject to change at any time.
+        Examples: []
       Print:
         Aliases:
         - print
@@ -2782,9 +2806,12 @@ tpl:
           - ''
       Warnmf:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - m
+        - format
+        - args
+        Description: Warnmf is experimental and subject to change at any time.
+        Examples: []
     hash:
       FNV32a:
         Aliases: null
@@ -2906,9 +2933,10 @@ tpl:
         Examples: null
       Filter:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - args
+        Description: Filter applies the given filters to the image given as the last element in args.
+        Examples: []
       Gamma:
         Aliases: null
         Args: null
@@ -2966,9 +2994,12 @@ tpl:
         Examples: null
       QR:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - args
+        Description: |-
+          QR encodes the given text into a QR code using the specified options,
+          returning an image resource.
+        Examples: []
       Saturation:
         Aliases: null
         Args: null
@@ -3042,14 +3073,20 @@ tpl:
         Examples: []
       Batch:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - id
+        Description: |-
+          Batch creates a new Batcher with the given ID.
+          Repeated calls with the same ID will return the same Batcher.
+          The ID will be used to name the root directory of the batch.
+          Forward slashes in the ID is allowed.
+        Examples: []
       Build:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - args
+        Description: Build processes the given Resource with ESBuild.
+        Examples: []
     lang:
       FormatAccounting:
         Aliases: null
@@ -3121,9 +3158,11 @@ tpl:
           - 512.50%
       Merge:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - p2
+        - p1
+        Description: Merge creates a union of pages from two languages.
+        Examples: []
       Translate:
         Aliases:
         - i18n
@@ -3204,8 +3243,8 @@ tpl:
       Counter:
         Aliases: null
         Args: null
-        Description: ''
-        Examples: null
+        Description: 'Counter increments and returns a global counter.\nThis was originally added to be used in tests where now.UnixNano did not\nhave the needed precision (especially on Windows).\nNote that given the parallel nature of Hugo, you cannot use this to get sequences of numbers,\nand the counter will reset on new builds.\n<docsmeta>{"identifiers": ["now.UnixNano"] }</docsmeta>'
+        Examples: []
       Div:
         Aliases:
         - div
@@ -3302,9 +3341,10 @@ tpl:
           - '8'
       Product:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - inputs
+        Description: Product returns the product of all numbers in inputs. Any slices in inputs are flattened.
+        Examples: []
       Rand:
         Aliases: null
         Args: null
@@ -3347,9 +3387,10 @@ tpl:
           - '1'
       Sum:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - inputs
+        Description: Sum returns the sum of all numbers in inputs. Any slices in inputs are flattened.
+        Examples: []
       Tan:
         Aliases: null
         Args:
@@ -3422,9 +3463,10 @@ tpl:
           - Hugo Rocks!
       Stat:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - i
+        Description: Stat returns the os.FileInfo structure describing file.
+        Examples: []
     partials:
       Include:
         Aliases:
@@ -3457,29 +3499,63 @@ tpl:
     path:
       Base:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - path
+        Description: |-
+          Base returns the last element of path.
+          Trailing slashes are removed before extracting the last element.
+          If the path is empty, Base returns ".".
+          If the path consists entirely of slashes, Base returns "/".
+          The input path is passed into filepath.ToSlash converting any Windows slashes
+          to forward slashes.
+        Examples: []
       BaseName:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - path
+        Description: |-
+          BaseName returns the last element of path, removing the extension if present.
+          Trailing slashes are removed before extracting the last element.
+          If the path is empty, Base returns ".".
+          If the path consists entirely of slashes, Base returns "/".
+          The input path is passed into filepath.ToSlash converting any Windows slashes
+          to forward slashes.
+        Examples: []
       Clean:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - path
+        Description: |-
+          Clean replaces the separators used with standard slashes and then
+          extraneous slashes are removed.
+        Examples: []
       Dir:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - path
+        Description: |-
+          Dir returns all but the last element of path, typically the path's directory.
+          After dropping the final element using Split, the path is Cleaned and trailing
+          slashes are removed.
+          If the path is empty, Dir returns ".".
+          If the path consists entirely of slashes followed by non-slash bytes, Dir
+          returns a single slash. In any other case, the returned path does not end in a
+          slash.
+          The input path is passed into filepath.ToSlash converting any Windows slashes
+          to forward slashes.
+        Examples: []
       Ext:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - path
+        Description: |-
+          Ext returns the file name extension used by path.
+          The extension is the suffix beginning at the final dot
+          in the final slash-separated element of path;
+          it is empty if there is no dot.
+          The input path is passed into filepath.ToSlash converting any Windows slashes
+          to forward slashes.
+        Examples: []
       Join:
         Aliases: null
         Args:
@@ -3539,29 +3615,41 @@ tpl:
     resources:
       Babel:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - args
+        Description: 'Babel processes the given Resource with Babel.\nDeprecated: Moved to the js namespace in Hugo 0.128.0.'
+        Examples: []
       ByType:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - typ
+        Description: ByType returns resources of a given resource type (e.g. "image").
+        Examples: []
       Concat:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - targetPathIn
+        - r
+        Description: |-
+          Concat concatenates a slice of Resource objects. These resources must
+          (currently) be of the same Media Type.
+        Examples: []
       Copy:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - s
+        - r
+        Description: Copy copies r to the new targetPath in s.
+        Examples: []
       ExecuteAsTemplate:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - ctx
+        - args
+        Description: |-
+          ExecuteAsTemplate creates a Resource from a Go template, parsed and executed with
+          the given data, and published to the relative target path.
+        Examples: []
       Fingerprint:
         Aliases:
         - fingerprint
@@ -3573,9 +3661,11 @@ tpl:
         Examples: []
       FromString:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - targetPathIn
+        - contentIn
+        Description: FromString creates a Resource from a string published to the relative target path.
+        Examples: []
       Get:
         Aliases: null
         Args:
@@ -3597,9 +3687,26 @@ tpl:
         Examples: []
       Match:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - pattern
+        Description: |-
+          Match gets all resources matching the given base path prefix, e.g
+          "*.png" will match all png files. The "*" does not match path delimiters (/),
+          so if you organize your resources in sub-folders, you need to be explicit about it, e.g.:
+          "images/*.png". To match any PNG image anywhere in the bundle you can do "**.png", and
+          to match all PNG images below the images folder, use "images/**.jpg".
+          
+          The matching is case insensitive.
+          
+          Match matches by using the files name with path relative to the file system root
+          with Unix style slashes (/) and no leading slash, e.g. "images/logo.png".
+          
+          See https://github.com/gobwas/glob for the full rules set.
+          
+          It looks for files in the assets file system.
+          
+          See Match for a more complete explanation about the rules used.
+        Examples: []
       Minify:
         Aliases:
         - minify
@@ -3611,19 +3718,22 @@ tpl:
         Examples: []
       PostCSS:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - args
+        Description: 'PostCSS processes the given Resource with PostCSS.\nDeprecated: Moved to the css namespace in Hugo 0.128.0.'
+        Examples: []
       PostProcess:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - r
+        Description: PostProcess processes r after the build.
+        Examples: []
       ToCSS:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - args
+        Description: 'ToCSS converts the given Resource to CSS. You can optional provide an Options object\nas second argument. As an option, you can e.g. specify e.g. the target path (string)\nfor the converted CSS resource.\nDeprecated: Moved to the css namespace in Hugo 0.128.0.'
+        Examples: []
     safe:
       CSS:
         Aliases:
@@ -3907,9 +4017,10 @@ tpl:
           - 'false'
       ContainsNonSpace:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - s
+        Description: 'ContainsNonSpace reports whether s contains any non-space characters as defined\nby Unicode''s White Space property,\n<docsmeta>{"newIn": "0.111.0" }</docsmeta>'
+        Examples: []
       Count:
         Aliases: null
         Args:
@@ -3937,9 +4048,15 @@ tpl:
         Examples: []
       Diff:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - oldname
+        - old
+        - newname
+        - new
+        Description: |-
+          Diff returns an anchored diff of the two texts old and new in the “unified
+          diff” format. If old and new are identical, Diff returns an empty string.
+        Examples: []
       FindRE:
         Aliases:
         - findRE
@@ -4172,9 +4289,12 @@ tpl:
           - aabb
       TrimSpace:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - s
+        Description: |-
+          TrimSpace returns the given string, removing leading and trailing whitespace
+          as defined by Unicode.
+        Examples: []
       TrimSuffix:
         Aliases: null
         Args:
@@ -4203,9 +4323,10 @@ tpl:
     templates:
       Current:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - ctx
+        Description: Get information about the currently executing template.
+        Examples: []
       Defer:
         Aliases: null
         Args:
@@ -4232,9 +4353,9 @@ tpl:
           Note that this is the Unix-styled relative path including filename suffix,
           e.g. partials/header.html
         Examples:
-        - - '{{ if (templates.Exists "partials/header.html") }}Yes!{{ end }}'
+        - - '{{ if (templates.Exists "_partials/header.html") }}Yes!{{ end }}'
           - Yes!
-        - - '{{ if not (templates.Exists "partials/doesnotexist.html") }}No!{{ end }}'
+        - - '{{ if not (templates.Exists "_partials/doesnotexist.html") }}No!{{ end }}'
           - No!
     time:
       AsTime:
@@ -4274,9 +4395,15 @@ tpl:
           - 'dateFormat: Wednesday, Jan 21, 2015'
       In:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - timeZoneName
+        - t
+        Description: |-
+          In returns the time t in the IANA time zone specified by timeZoneName.
+          If timeZoneName is "" or "UTC", the time is returned in UTC.
+          If timeZoneName is "Local", the time is returned in the system's local time zone.
+          Otherwise, timeZoneName must be a valid IANA location name (e.g., "Europe/Oslo").
+        Examples: []
       Now:
         Aliases:
         - now
@@ -4294,9 +4421,10 @@ tpl:
     transform:
       CanHighlight:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - language
+        Description: CanHighlight returns whether the given code language is supported by the Chroma highlighter.
+        Examples: []
       Emojify:
         Aliases:
         - emojify
@@ -4324,9 +4452,14 @@ tpl:
           - Cathal Garvey & The Sunshine Band <cathal@foo.bar>
       HTMLToMarkdown:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - ctx
+        - args
+        Description: |-
+          This was added in Hugo v0.151.0 and should be considered experimental for now.
+          We need to test this out in the wild for a while before committing to this API,
+          and there will eventually be more options here.
+        Examples: []
       HTMLUnescape:
         Aliases:
         - htmlUnescape
@@ -4357,9 +4490,11 @@ tpl:
         Examples: []
       HighlightCodeBlock:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - ctx
+        - opts
+        Description: HighlightCodeBlock highlights a code block on the form received in the codeblock render hooks.
+        Examples: []
       Markdownify:
         Aliases:
         - markdownify
@@ -4381,9 +4516,12 @@ tpl:
           - Hello world, gophers!
       PortableText:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - v
+        Description: |-
+          PortableText converts the portable text in v to Markdown.
+          We may add more options in the future.
+        Examples: []
       Remarshal:
         Aliases: null
         Args:
@@ -4401,9 +4539,13 @@ tpl:
           - '{\n   "title": "Hello World"\n}\n'
       ToMath:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - ctx
+        - args
+        Description: |-
+          ToMath converts a LaTeX string to math in the given format, default MathML.
+          This uses KaTeX to render the math, see https://katex.org/.
+        Examples: []
       Unmarshal:
         Aliases:
         - unmarshal
@@ -4472,9 +4614,29 @@ tpl:
           - a/b
       Parse:
         Aliases: null
-        Args: null
-        Description: ''
-        Examples: null
+        Args:
+        - rawurl
+        Description: |-
+          Parse parses rawurl into a URL structure. The rawurl may be relative or
+          absolute.
+        Examples: []
+      PathEscape:
+        Aliases: null
+        Args:
+        - s
+        Description: |-
+          PathEscape returns the given string, applying percent-encoding to special
+          characters and reserved delimiters so it can be safely used as a segment
+          within a URL path.
+        Examples: []
+      PathUnescape:
+        Aliases: null
+        Args:
+        - s
+        Description: |-
+          PathUnescape returns the given string, replacing all percent-encoded
+          sequences with the corresponding unescaped characters.
+        Examples: []
       Ref:
         Aliases:
         - ref
index 84211a00b0a00fa02e77ce4dd1cd282c3562d384..d3ee7279ee9f0e2e1063b93d0ee784d13e95d962 100644 (file)
@@ -31,6 +31,13 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               ns.AddMethodMapping(ctx.ToFloat,
+                       []string{"float"},
+                       [][2]string{
+                               {`{{ "1234" | float | printf "%T" }}`, `float64`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.ToInt,
                        []string{"int"},
                        [][2]string{
@@ -45,13 +52,6 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.ToFloat,
-                       []string{"float"},
-                       [][2]string{
-                               {`{{ "1234" | float | printf "%T" }}`, `float64`},
-                       },
-               )
-
                return ns
        }
 
index f89651326bcc4445ea5a7dacf445c599b2d2acc0..e29053f30541ade1811faf4e0cf878355c1f0ddd 100644 (file)
@@ -36,6 +36,11 @@ func init() {
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.Append,
+                       []string{"append"},
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Apply,
                        []string{"apply"},
                        [][2]string{},
@@ -48,11 +53,9 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.SymDiff,
-                       []string{"symdiff"},
-                       [][2]string{
-                               {`{{ slice 1 2 3 | symdiff (slice 3 4) }}`, `[1 2 4]`},
-                       },
+               ns.AddMethodMapping(ctx.D,
+                       nil,
+                       [][2]string{},
                )
 
                ns.AddMethodMapping(ctx.Delimit,
@@ -72,11 +75,9 @@ func init() {
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.KeyVals,
-                       []string{"keyVals"},
-                       [][2]string{
-                               {`{{ keyVals "key" "a" "b" }}`, `key: [a b]`},
-                       },
+               ns.AddMethodMapping(ctx.Group,
+                       []string{"group"},
+                       [][2]string{},
                )
 
                ns.AddMethodMapping(ctx.In,
@@ -101,11 +102,43 @@ func init() {
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.KeyVals,
+                       []string{"keyVals"},
+                       [][2]string{
+                               {`{{ keyVals "key" "a" "b" }}`, `key: [a b]`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.Last,
                        []string{"last"},
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.Merge,
+                       []string{"merge"},
+                       [][2]string{
+                               {
+                                       `{{ dict "title" "Hugo Rocks!" | collections.Merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") | sort }}`,
+                                       `[Yes, Hugo Rocks! Hugo Rocks!]`,
+                               },
+                               {
+                                       `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") | sort }}`,
+                                       `[Yes, Hugo Rocks! Hugo Rocks!]`,
+                               },
+                               {
+                                       `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") (dict "extra" "For reals!") | sort }}`,
+                                       `[Yes, Hugo Rocks! For reals! Hugo Rocks!]`,
+                               },
+                       },
+               )
+
+               ns.AddMethodMapping(ctx.NewScratch,
+                       []string{"newScratch"},
+                       [][2]string{
+                               {`{{ $scratch := newScratch }}{{ $scratch.Add "b" 2 }}{{ $scratch.Add "b" 2 }}{{ $scratch.Get "b" }}`, `4`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.Querify,
                        []string{"querify"},
                        [][2]string{
@@ -124,56 +157,46 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.Shuffle,
-                       []string{"shuffle"},
+               ns.AddMethodMapping(ctx.Reverse,
+                       nil,
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.Slice,
-                       []string{"slice"},
+               ns.AddMethodMapping(ctx.Seq,
+                       []string{"seq"},
                        [][2]string{
-                               {`{{ slice "B" "C" "A" | sort }}`, `[A B C]`},
+                               {`{{ seq 3 }}`, `[1 2 3]`},
                        },
                )
 
-               ns.AddMethodMapping(ctx.Sort,
-                       []string{"sort"},
+               ns.AddMethodMapping(ctx.Shuffle,
+                       []string{"shuffle"},
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.Union,
-                       []string{"union"},
+               ns.AddMethodMapping(ctx.Slice,
+                       []string{"slice"},
                        [][2]string{
-                               {`{{ union (slice 1 2 3) (slice 3 4 5) }}`, `[1 2 3 4 5]`},
+                               {`{{ slice "B" "C" "A" | sort }}`, `[A B C]`},
                        },
                )
 
-               ns.AddMethodMapping(ctx.Where,
-                       []string{"where"},
-                       [][2]string{},
-               )
-
-               ns.AddMethodMapping(ctx.Append,
-                       []string{"append"},
-                       [][2]string{},
-               )
-
-               ns.AddMethodMapping(ctx.Group,
-                       []string{"group"},
+               ns.AddMethodMapping(ctx.Sort,
+                       []string{"sort"},
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.Seq,
-                       []string{"seq"},
+               ns.AddMethodMapping(ctx.SymDiff,
+                       []string{"symdiff"},
                        [][2]string{
-                               {`{{ seq 3 }}`, `[1 2 3]`},
+                               {`{{ slice 1 2 3 | symdiff (slice 3 4) }}`, `[1 2 4]`},
                        },
                )
 
-               ns.AddMethodMapping(ctx.NewScratch,
-                       []string{"newScratch"},
+               ns.AddMethodMapping(ctx.Union,
+                       []string{"union"},
                        [][2]string{
-                               {`{{ $scratch := newScratch }}{{ $scratch.Add "b" 2 }}{{ $scratch.Add "b" 2 }}{{ $scratch.Get "b" }}`, `4`},
+                               {`{{ union (slice 1 2 3) (slice 3 4 5) }}`, `[1 2 3 4 5]`},
                        },
                )
 
@@ -184,22 +207,9 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.Merge,
-                       []string{"merge"},
-                       [][2]string{
-                               {
-                                       `{{ dict "title" "Hugo Rocks!" | collections.Merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") | sort }}`,
-                                       `[Yes, Hugo Rocks! Hugo Rocks!]`,
-                               },
-                               {
-                                       `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") | sort }}`,
-                                       `[Yes, Hugo Rocks! Hugo Rocks!]`,
-                               },
-                               {
-                                       `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") (dict "extra" "For reals!") | sort }}`,
-                                       `[Yes, Hugo Rocks! For reals! Hugo Rocks!]`,
-                               },
-                       },
+               ns.AddMethodMapping(ctx.Where,
+                       []string{"where"},
+                       [][2]string{},
                )
 
                return ns
index 4d789af3b5a21472e5b24b075466bad2d20e20df..c6e325de52dfebe4a026b3513d10150cc35b4bfd 100644 (file)
@@ -37,6 +37,13 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               ns.AddMethodMapping(ctx.Conditional,
+                       []string{"cond"},
+                       [][2]string{
+                               {`{{ cond (eq (add 2 2) 4) "2+2 is 4" "what?" | safeHTML }}`, `2+2 is 4`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.Default,
                        []string{"default"},
                        [][2]string{
@@ -74,16 +81,15 @@ func init() {
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.Ne,
-                       []string{"ne"},
+               // For internal use only.
+               ns.AddMethodMapping(ctx.LtCollate,
+                       nil,
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.Conditional,
-                       []string{"cond"},
-                       [][2]string{
-                               {`{{ cond (eq (add 2 2) 4) "2+2 is 4" "what?" | safeHTML }}`, `2+2 is 4`},
-                       },
+               ns.AddMethodMapping(ctx.Ne,
+                       []string{"ne"},
+                       [][2]string{},
                )
 
                return ns
index 0527fba06d062cfd6ecb661265131e3987e3e533..52f722a02d2823d2bdc107a38ac211233573ee22 100644 (file)
@@ -31,6 +31,19 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               // Deprecated. Use hash.FNV32a instead.
+               ns.AddMethodMapping(ctx.FNV32a,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.HMAC,
+                       []string{"hmac"},
+                       [][2]string{
+                               {`{{ hmac "sha256" "Secret key" "Hello world, gophers!" }}`, `b6d11b6c53830b9d87036272ca9fe9d19306b8f9d8aa07b15da27d89e6e34f40`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.MD5,
                        []string{"md5"},
                        [][2]string{
@@ -53,13 +66,6 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.HMAC,
-                       []string{"hmac"},
-                       [][2]string{
-                               {`{{ hmac "sha256" "Secret key" "Hello world, gophers!" }}`, `b6d11b6c53830b9d87036272ca9fe9d19306b8f9d8aa07b15da27d89e6e34f40`},
-                       },
-               )
-
                return ns
        }
 
index 199deda6902562191a2f87e67058febbf8ba0fa8..ba21c899763e6c16ae108d500b058f12cc98e9a8 100644 (file)
@@ -162,13 +162,28 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               ns.AddMethodMapping(ctx.PostCSS,
+                       []string{"postCSS"},
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Quoted,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Sass,
                        []string{"toCSS"},
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.PostCSS,
-                       []string{"postCSS"},
+               ns.AddMethodMapping(ctx.TailwindCSS,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Unquoted,
+                       nil,
                        [][2]string{},
                )
 
index 507e0d43e9c97f92f270984a3a143222ad19ce3e..47656d39859d95b076580cc2aa11ae099fc32106 100644 (file)
@@ -31,11 +31,13 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               // Deprecated. Use resources.GetRemote instead.
                ns.AddMethodMapping(ctx.GetCSV,
                        []string{"getCSV"},
                        [][2]string{},
                )
 
+               // Deprecated. Use resources.GetRemote instead.
                ns.AddMethodMapping(ctx.GetJSON,
                        []string{"getJSON"},
                        [][2]string{},
index 1232a4166da29fcbe2eb96ccbd490dde9fb9f5e9..3c789d8c8d66ceda622b5404c5a3387a585d8fe5 100644 (file)
@@ -40,6 +40,34 @@ func init() {
                        },
                )
 
+               // For internal use only. Used in tests.
+               ns.AddMethodMapping(ctx.TestDeprecationErr,
+                       nil,
+                       [][2]string{},
+               )
+
+               // For internal use only. Used in tests.
+               ns.AddMethodMapping(ctx.TestDeprecationInfo,
+                       nil,
+                       [][2]string{},
+               )
+
+               // For internal use only. Used in tests.
+               ns.AddMethodMapping(ctx.TestDeprecationWarn,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Timer,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.VisualizeSpaces,
+                       nil,
+                       [][2]string{},
+               )
+
                return ns
        }
 
index 0cbec7e1b8ff651fe6ad9d30e8e3a9cfd513b291..e1fc5d18b219231ad75702a296b7b145735c2fe7 100644 (file)
@@ -34,6 +34,11 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               ns.AddMethodMapping(ctx.Goat,
+                       nil,
+                       [][2]string{},
+               )
+
                return ns
        }
 
index 701bd3b6a6af0556392c639ab63a4c1de7cfa304..0b0e71749780b4cdeaac3c19a880ccfb2c8662d8 100644 (file)
@@ -31,17 +31,30 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
-               ns.AddMethodMapping(ctx.Print,
-                       []string{"print"},
+               ns.AddMethodMapping(ctx.Errorf,
+                       []string{"errorf"},
                        [][2]string{
-                               {`{{ print "works!" }}`, `works!`},
+                               {`{{ errorf "%s." "failed" }}`, ``},
                        },
                )
 
-               ns.AddMethodMapping(ctx.Println,
-                       []string{"println"},
+               ns.AddMethodMapping(ctx.Erroridf,
+                       []string{"erroridf"},
                        [][2]string{
-                               {`{{ println "works!" }}`, "works!\n"},
+                               {`{{ erroridf "my-err-id" "%s." "failed" }}`, ``},
+                       },
+               )
+
+               // Experimental. Not documented.
+               ns.AddMethodMapping(ctx.Errormf,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Print,
+                       []string{"print"},
+                       [][2]string{
+                               {`{{ print "works!" }}`, `works!`},
                        },
                )
 
@@ -52,17 +65,17 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.Errorf,
-                       []string{"errorf"},
+               ns.AddMethodMapping(ctx.Println,
+                       []string{"println"},
                        [][2]string{
-                               {`{{ errorf "%s." "failed" }}`, ``},
+                               {`{{ println "works!" }}`, "works!\n"},
                        },
                )
 
-               ns.AddMethodMapping(ctx.Erroridf,
-                       []string{"erroridf"},
+               ns.AddMethodMapping(ctx.Warnf,
+                       []string{"warnf"},
                        [][2]string{
-                               {`{{ erroridf "my-err-id" "%s." "failed" }}`, ``},
+                               {`{{ warnf "%s." "warning" }}`, ``},
                        },
                )
 
@@ -73,12 +86,12 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.Warnf,
-                       []string{"warnf"},
-                       [][2]string{
-                               {`{{ warnf "%s." "warning" }}`, ``},
-                       },
+               // Experimental. Not documented.
+               ns.AddMethodMapping(ctx.Warnmf,
+                       nil,
+                       [][2]string{},
                )
+
                return ns
        }
 
index 00df4e3cdf0b1ea936d7785ab3fc8e1eb3626371..b82fc3679cc56411905344870c29da2299d508c8 100644 (file)
@@ -64,17 +64,17 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
-               ns.AddMethodMapping(ctx.XxHash,
-                       []string{"xxhash"},
+               ns.AddMethodMapping(ctx.FNV32a,
+                       nil,
                        [][2]string{
-                               {`{{ hash.XxHash "The quick brown fox jumps over the lazy dog" }}`, `0b242d361fda71bc`},
+                               {`{{ hash.FNV32a "Hugo Rocks!!" }}`, `1515779328`},
                        },
                )
 
-               ns.AddMethodMapping(ctx.FNV32a,
-                       nil,
+               ns.AddMethodMapping(ctx.XxHash,
+                       []string{"xxhash"},
                        [][2]string{
-                               {`{{ hash.FNV32a "Hugo Rocks!!" }}`, `1515779328`},
+                               {`{{ hash.XxHash "The quick brown fox jumps over the lazy dog" }}`, `0b242d361fda71bc`},
                        },
                )
 
index a350d5b9d2a8ac230834d818cd9abf20d1fdd04e..7398dc9ed84688a433dadf332993efcd49caf4e8 100644 (file)
@@ -36,6 +36,16 @@ func init() {
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.Filter,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.QR,
+                       nil,
+                       [][2]string{},
+               )
+
                return ns
        }
 
index 97e76c33d87eea32c2afa59d91da6009cb6bafb1..54ae1d29afcba46637395fd014e2e455e3b80a11 100644 (file)
@@ -39,6 +39,16 @@ func init() {
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.Batch,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Build,
+                       nil,
+                       [][2]string{},
+               )
+
                return ns
        }
 
index 0c07daa383bed1cc70e92da26b9c759b30907c15..1b2db6a470a7bcc7499609b9484993c88734e505 100644 (file)
@@ -32,22 +32,10 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
-               ns.AddMethodMapping(ctx.Translate,
-                       []string{"i18n", "T"},
-                       [][2]string{},
-               )
-
-               ns.AddMethodMapping(ctx.FormatNumber,
-                       nil,
-                       [][2]string{
-                               {`{{ 512.5032 | lang.FormatNumber 2 }}`, `512.50`},
-                       },
-               )
-
-               ns.AddMethodMapping(ctx.FormatPercent,
+               ns.AddMethodMapping(ctx.FormatAccounting,
                        nil,
                        [][2]string{
-                               {`{{ 512.5032 | lang.FormatPercent 2 }}`, `512.50%`},
+                               {`{{ 512.5032 | lang.FormatAccounting 2 "NOK" }}`, `NOK512.50`},
                        },
                )
 
@@ -58,10 +46,10 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.FormatAccounting,
+               ns.AddMethodMapping(ctx.FormatNumber,
                        nil,
                        [][2]string{
-                               {`{{ 512.5032 | lang.FormatAccounting 2 "NOK" }}`, `NOK512.50`},
+                               {`{{ 512.5032 | lang.FormatNumber 2 }}`, `512.50`},
                        },
                )
 
@@ -77,6 +65,23 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.FormatPercent,
+                       nil,
+                       [][2]string{
+                               {`{{ 512.5032 | lang.FormatPercent 2 }}`, `512.50%`},
+                       },
+               )
+
+               ns.AddMethodMapping(ctx.Merge,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Translate,
+                       []string{"i18n", "T"},
+                       [][2]string{},
+               )
+
                return ns
        }
 
index e34c892f076529deda210a75e93fd943135b5ac5..f7e954bdb6721e987dc9c15a1ef664e3f92034e2 100644 (file)
@@ -95,6 +95,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.Counter,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Div,
                        []string{"div"},
                        [][2]string{
@@ -172,6 +177,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.Product,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Rand,
                        nil,
                        [][2]string{
@@ -207,6 +217,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.Sum,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Tan,
                        nil,
                        [][2]string{
index d7afba16fbc736f09c293dbb63fcf8ac959f599d..a60a095e758417da5fc0a3b6d3cd289b18a5bbc9 100644 (file)
@@ -31,6 +31,13 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               ns.AddMethodMapping(ctx.FileExists,
+                       []string{"fileExists"},
+                       [][2]string{
+                               {`{{ fileExists "foo.txt" }}`, `false`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.Getenv,
                        []string{"getenv"},
                        [][2]string{},
@@ -50,11 +57,9 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.FileExists,
-                       []string{"fileExists"},
-                       [][2]string{
-                               {`{{ fileExists "foo.txt" }}`, `false`},
-                       },
+               ns.AddMethodMapping(ctx.Stat,
+                       nil,
+                       [][2]string{},
                )
 
                return ns
index 6f7c0ffc1e78f53e568e1320bb6df4fa7271d447..7d45f0eaf16d2a44ea975838094d6354b1615f39 100644 (file)
@@ -38,6 +38,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.IncludeCached,
+                       []string{"partialCached"},
+                       [][2]string{},
+               )
+
                // TODO(bep) we need the return to be a valid identifiers, but
                // should consider another way of adding it.
                ns.AddMethodMapping(func() string { return "" },
@@ -45,11 +50,6 @@ func init() {
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.IncludeCached,
-                       []string{"partialCached"},
-                       [][2]string{},
-               )
-
                return ns
        }
 
index 97a479d3f01e737652c4df5faa0261e2e5544ac7..5193ff7901c107ac8cbfa002608d677d0fd53e85 100644 (file)
@@ -33,12 +33,29 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
-               ns.AddMethodMapping(ctx.Split,
+               ns.AddMethodMapping(ctx.Base,
                        nil,
-                       [][2]string{
-                               {`{{ "/my/path/filename.txt" | path.Split }}`, `/my/path/|filename.txt`},
-                               {fmt.Sprintf(`{{ %q | path.Split }}`, filepath.FromSlash("/my/path/filename.txt")), `/my/path/|filename.txt`},
-                       },
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.BaseName,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Clean,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Dir,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Ext,
+                       nil,
+                       [][2]string{},
                )
 
                testDir := filepath.Join("my", "path")
@@ -55,6 +72,14 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.Split,
+                       nil,
+                       [][2]string{
+                               {`{{ "/my/path/filename.txt" | path.Split }}`, `/my/path/|filename.txt`},
+                               {fmt.Sprintf(`{{ %q | path.Split }}`, filepath.FromSlash("/my/path/filename.txt")), `/my/path/|filename.txt`},
+                       },
+               )
+
                return ns
        }
        internal.AddTemplateFuncsNamespace(f)
index 5cea482acc36ff47bb0bc57a867749cae478f8ac..9048e3a461602054bf2df0320db2bfdba35611fd 100644 (file)
@@ -53,28 +53,84 @@ func init() {
                        },
                }
 
-               ns.AddMethodMapping(ctx.Get,
+               // Deprecated. Use js.Babel instead.
+               ns.AddMethodMapping(ctx.Babel,
                        nil,
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.GetRemote,
+               ns.AddMethodMapping(ctx.ByType,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Concat,
                        nil,
                        [][2]string{},
                )
 
-               // Add aliases for the most common transformations.
+               ns.AddMethodMapping(ctx.Copy,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.ExecuteAsTemplate,
+                       nil,
+                       [][2]string{},
+               )
 
                ns.AddMethodMapping(ctx.Fingerprint,
                        []string{"fingerprint"},
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.FromString,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Get,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Match,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.GetRemote,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Match,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Minify,
                        []string{"minify"},
                        [][2]string{},
                )
 
+               // Deprecated. Use css.PostCSS instead.
+               ns.AddMethodMapping(ctx.PostCSS,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.PostProcess,
+                       nil,
+                       [][2]string{},
+               )
+
+               // Deprecated. Use css.Sass instead.
+               ns.AddMethodMapping(ctx.ToCSS,
+                       nil,
+                       [][2]string{},
+               )
+
                return ns
        }
 
index b236d110a54f4e513ed31c19645a5bd25a05ac16..75473e4c156609b7c34317897c77a0b618b3d0f3 100644 (file)
@@ -38,18 +38,24 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.CountRunes,
-                       []string{"countrunes"},
-                       [][2]string{},
+               ns.AddMethodMapping(ctx.Contains,
+                       nil,
+                       [][2]string{
+                               {`{{ strings.Contains "abc" "b" }}`, `true`},
+                               {`{{ strings.Contains "abc" "d" }}`, `false`},
+                       },
                )
 
-               ns.AddMethodMapping(ctx.RuneCount,
+               ns.AddMethodMapping(ctx.ContainsAny,
                        nil,
-                       [][2]string{},
+                       [][2]string{
+                               {`{{ strings.ContainsAny "abc" "bcd" }}`, `true`},
+                               {`{{ strings.ContainsAny "abc" "def" }}`, `false`},
+                       },
                )
 
-               ns.AddMethodMapping(ctx.CountWords,
-                       []string{"countwords"},
+               ns.AddMethodMapping(ctx.ContainsNonSpace,
+                       nil,
                        [][2]string{},
                )
 
@@ -60,20 +66,19 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.Contains,
-                       nil,
-                       [][2]string{
-                               {`{{ strings.Contains "abc" "b" }}`, `true`},
-                               {`{{ strings.Contains "abc" "d" }}`, `false`},
-                       },
+               ns.AddMethodMapping(ctx.CountRunes,
+                       []string{"countrunes"},
+                       [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.ContainsAny,
+               ns.AddMethodMapping(ctx.CountWords,
+                       []string{"countwords"},
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Diff,
                        nil,
-                       [][2]string{
-                               {`{{ strings.ContainsAny "abc" "bcd" }}`, `true`},
-                               {`{{ strings.ContainsAny "abc" "def" }}`, `false`},
-                       },
+                       [][2]string{},
                )
 
                ns.AddMethodMapping(ctx.FindRE,
@@ -96,6 +101,13 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.FirstUpper,
+                       nil,
+                       [][2]string{
+                               {`{{ "hugo rocks!" | strings.FirstUpper }}`, `Hugo rocks!`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.HasPrefix,
                        []string{"hasPrefix"},
                        [][2]string{
@@ -112,10 +124,10 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.ToLower,
-                       []string{"lower"},
+               ns.AddMethodMapping(ctx.Repeat,
+                       nil,
                        [][2]string{
-                               {`{{ lower "BatMan" }}`, `batman`},
+                               {`{{ "yo" | strings.Repeat 4 }}`, `yoyoyoyo`},
                        },
                )
 
@@ -147,6 +159,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.RuneCount,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.SliceString,
                        []string{"slicestr"},
                        [][2]string{
@@ -168,6 +185,28 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.Title,
+                       []string{"title"},
+                       [][2]string{
+                               {`{{ title "Bat man" }}`, `Bat Man`},
+                               {`{{ title "somewhere over the rainbow" }}`, `Somewhere Over the Rainbow`},
+                       },
+               )
+
+               ns.AddMethodMapping(ctx.ToLower,
+                       []string{"lower"},
+                       [][2]string{
+                               {`{{ lower "BatMan" }}`, `batman`},
+                       },
+               )
+
+               ns.AddMethodMapping(ctx.ToUpper,
+                       []string{"upper"},
+                       [][2]string{
+                               {`{{ upper "BatMan" }}`, `BATMAN`},
+                       },
+               )
+
                ns.AddMethodMapping(ctx.Trim,
                        []string{"trim"},
                        [][2]string{
@@ -197,26 +236,16 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.TrimSuffix,
+               ns.AddMethodMapping(ctx.TrimSpace,
                        nil,
-                       [][2]string{
-                               {`{{ "aabbaa" | strings.TrimSuffix "a" }}`, `aabba`},
-                               {`{{ "aabbaa" | strings.TrimSuffix "aa" }}`, `aabb`},
-                       },
-               )
-
-               ns.AddMethodMapping(ctx.Title,
-                       []string{"title"},
-                       [][2]string{
-                               {`{{ title "Bat man" }}`, `Bat Man`},
-                               {`{{ title "somewhere over the rainbow" }}`, `Somewhere Over the Rainbow`},
-                       },
+                       [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.FirstUpper,
+               ns.AddMethodMapping(ctx.TrimSuffix,
                        nil,
                        [][2]string{
-                               {`{{ "hugo rocks!" | strings.FirstUpper }}`, `Hugo rocks!`},
+                               {`{{ "aabbaa" | strings.TrimSuffix "a" }}`, `aabba`},
+                               {`{{ "aabbaa" | strings.TrimSuffix "aa" }}`, `aabb`},
                        },
                )
 
@@ -228,20 +257,6 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.Repeat,
-                       nil,
-                       [][2]string{
-                               {`{{ "yo" | strings.Repeat 4 }}`, `yoyoyoyo`},
-                       },
-               )
-
-               ns.AddMethodMapping(ctx.ToUpper,
-                       []string{"upper"},
-                       [][2]string{
-                               {`{{ upper "BatMan" }}`, `BATMAN`},
-                       },
-               )
-
                return ns
        }
 
index 4e5251d0dc70626227cbace7864782482407a8e7..ac62194bbdb3725eb7516cd754e3fe5840bec7d0 100644 (file)
@@ -31,12 +31,9 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
-               ns.AddMethodMapping(ctx.Exists,
+               ns.AddMethodMapping(ctx.Current,
                        nil,
-                       [][2]string{
-                               {`{{ if (templates.Exists "_partials/header.html") }}Yes!{{ end }}`, `Yes!`},
-                               {`{{ if not (templates.Exists "_partials/doesnotexist.html") }}No!{{ end }}`, `No!`},
-                       },
+                       [][2]string{},
                )
 
                ns.AddMethodMapping(ctx.Defer,
@@ -44,11 +41,20 @@ func init() {
                        [][2]string{},
                )
 
+               // For internal use only.
                ns.AddMethodMapping(ctx.DoDefer,
                        []string{"doDefer"},
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.Exists,
+                       nil,
+                       [][2]string{
+                               {`{{ if (templates.Exists "_partials/header.html") }}Yes!{{ end }}`, `Yes!`},
+                               {`{{ if not (templates.Exists "_partials/doesnotexist.html") }}No!{{ end }}`, `No!`},
+                       },
+               )
+
                return ns
        }
 
index 525be2cf527a50289b43ddbcc467a351f5a73658..3f84d88a2c6dea0e6e59c8bb5b65e26e4edd6837 100644 (file)
@@ -57,18 +57,6 @@ func init() {
                        },
                }
 
-               ns.AddMethodMapping(ctx.Format,
-                       []string{"dateFormat"},
-                       [][2]string{
-                               {`dateFormat: {{ dateFormat "Monday, Jan 2, 2006" "2015-01-21" }}`, `dateFormat: Wednesday, Jan 21, 2015`},
-                       },
-               )
-
-               ns.AddMethodMapping(ctx.Now,
-                       []string{"now"},
-                       [][2]string{},
-               )
-
                ns.AddMethodMapping(ctx.AsTime,
                        nil,
                        [][2]string{
@@ -83,6 +71,23 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.Format,
+                       []string{"dateFormat"},
+                       [][2]string{
+                               {`dateFormat: {{ dateFormat "Monday, Jan 2, 2006" "2015-01-21" }}`, `dateFormat: Wednesday, Jan 21, 2015`},
+                       },
+               )
+
+               ns.AddMethodMapping(ctx.In,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Now,
+                       []string{"now"},
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.ParseDuration,
                        nil,
                        [][2]string{
index e439604277a35920b44930e084726e9ba17a49fd..6aa95938aa8977276e6ebe6b8742e74e0278ec8d 100644 (file)
@@ -31,6 +31,11 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               ns.AddMethodMapping(ctx.CanHighlight,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Emojify,
                        []string{"emojify"},
                        [][2]string{
@@ -43,6 +48,11 @@ func init() {
                        [][2]string{},
                )
 
+               ns.AddMethodMapping(ctx.HighlightCodeBlock,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.HTMLEscape,
                        []string{"htmlEscape"},
                        [][2]string{
@@ -61,6 +71,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.HTMLToMarkdown,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.HTMLUnescape,
                        []string{"htmlUnescape"},
                        [][2]string{
@@ -97,6 +112,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.PortableText,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Remarshal,
                        nil,
                        [][2]string{
@@ -104,6 +124,11 @@ func init() {
                        },
                )
 
+               ns.AddMethodMapping(ctx.ToMath,
+                       nil,
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.Unmarshal,
                        []string{"unmarshal"},
                        [][2]string{
index cdc597f3444b5718269f5626d9d039c69212543e..82208e5386e34ba7bdade49e64f7b322b2254786 100644 (file)
@@ -31,49 +31,69 @@ func init() {
                        Context: func(cctx context.Context, args ...any) (any, error) { return ctx, nil },
                }
 
+               ns.AddMethodMapping(ctx.AbsLangURL,
+                       []string{"absLangURL"},
+                       [][2]string{},
+               )
+
                ns.AddMethodMapping(ctx.AbsURL,
                        []string{"absURL"},
                        [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.AbsLangURL,
-                       []string{"absLangURL"},
+               ns.AddMethodMapping(ctx.Anchorize,
+                       []string{"anchorize"},
+                       [][2]string{
+                               {`{{ "This is a title" | anchorize }}`, `this-is-a-title`},
+                       },
+               )
+
+               ns.AddMethodMapping(ctx.JoinPath,
+                       nil,
+                       [][2]string{
+                               {`{{ urls.JoinPath "https://example.org" "foo" }}`, `https://example.org/foo`},
+                               {`{{ urls.JoinPath (slice "a" "b") }}`, `a/b`},
+                       },
+               )
+
+               ns.AddMethodMapping(ctx.Parse,
+                       nil,
                        [][2]string{},
                )
-               ns.AddMethodMapping(ctx.Ref,
-                       []string{"ref"},
+
+               ns.AddMethodMapping(ctx.PathEscape,
+                       nil,
                        [][2]string{},
                )
-               ns.AddMethodMapping(ctx.RelURL,
-                       []string{"relURL"},
+
+               ns.AddMethodMapping(ctx.PathUnescape,
+                       nil,
+                       [][2]string{},
+               )
+
+               ns.AddMethodMapping(ctx.Ref,
+                       []string{"ref"},
                        [][2]string{},
                )
+
                ns.AddMethodMapping(ctx.RelLangURL,
                        []string{"relLangURL"},
                        [][2]string{},
                )
+
                ns.AddMethodMapping(ctx.RelRef,
                        []string{"relref"},
                        [][2]string{},
                )
-               ns.AddMethodMapping(ctx.URLize,
-                       []string{"urlize"},
-                       [][2]string{},
-               )
 
-               ns.AddMethodMapping(ctx.Anchorize,
-                       []string{"anchorize"},
-                       [][2]string{
-                               {`{{ "This is a title" | anchorize }}`, `this-is-a-title`},
-                       },
+               ns.AddMethodMapping(ctx.RelURL,
+                       []string{"relURL"},
+                       [][2]string{},
                )
 
-               ns.AddMethodMapping(ctx.JoinPath,
-                       nil,
-                       [][2]string{
-                               {`{{ urls.JoinPath "https://example.org" "foo" }}`, `https://example.org/foo`},
-                               {`{{ urls.JoinPath (slice "a" "b") }}`, `a/b`},
-                       },
+               ns.AddMethodMapping(ctx.URLize,
+                       []string{"urlize"},
+                       [][2]string{},
                )
 
                return ns