mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
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
This commit is contained in:
parent
02ab77da3e
commit
d171d1543d
3 changed files with 31 additions and 2 deletions
|
@ -9,11 +9,11 @@ categories: [functions]
|
|||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: []
|
||||
keywords: [strings]
|
||||
signature: ["hasPrefix STRING PREFIX"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
relatedfuncs: [hasSuffix]
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
|
21
docs/content/en/functions/hasSuffix.md
Normal file
21
docs/content/en/functions/hasSuffix.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
title: hassuffix
|
||||
linktitle: hasSuffix
|
||||
description: Tests whether a string ends with suffix.
|
||||
date: 2023-03-01
|
||||
publishdate: 2023-03-01
|
||||
lastmod: 2023-03-01
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [strings]
|
||||
signature: ["hasSuffix STRING SUFFIX"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: [hasPrefix]
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
* `{{ hasSuffix "Hugo" "go" }}` → true
|
|
@ -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{
|
||||
|
|
Loading…
Reference in a new issue