aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/strings
diff options
context:
space:
mode:
authorJonathan Fisher <[email protected]>2023-03-01 14:29:33 -0800
committerBjørn Erik Pedersen <[email protected]>2023-03-08 10:18:34 +0100
commitd171d1543d6df3f93a368c240a247513e5b7da44 (patch)
tree6cc1500d9691e1a44c15d89be72868943eb039c2 /tpl/strings
parent02ab77da3e6af762b1eececc852fd851fc79b30b (diff)
downloadhugo-d171d1543d6df3f93a368c240a247513e5b7da44.tar.gz
hugo-d171d1543d6df3f93a368c240a247513e5b7da44.zip
tpl: Add hasSuffix alias
strings.HasPrefix already has an alias of hasPrefix but strings.HasSuffix has no such alias. This PR adds a hasSuffix alias to the tpl function with corresponding function documentation. It also adds a Minor update to the hasPrefix function documentation re: keywords and relatedfuncs. Completes https://github.com/gohugoio/hugo/issues/10474
Diffstat (limited to 'tpl/strings')
-rw-r--r--tpl/strings/init.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/tpl/strings/init.go b/tpl/strings/init.go
index 37a489128..b236d110a 100644
--- a/tpl/strings/init.go
+++ b/tpl/strings/init.go
@@ -104,6 +104,14 @@ func init() {
},
)
+ ns.AddMethodMapping(ctx.HasSuffix,
+ []string{"hasSuffix"},
+ [][2]string{
+ {`{{ hasSuffix "Hugo" "go" }}`, `true`},
+ {`{{ hasSuffix "Hugo" "du" }}`, `false`},
+ },
+ )
+
ns.AddMethodMapping(ctx.ToLower,
[]string{"lower"},
[][2]string{