tpl: Add limit option to replace template function

Updates #7586
This commit is contained in:
Cameron Moore
2020-08-27 21:59:20 -05:00
committed by Bjørn Erik Pedersen
parent d39636a5fc
commit f9ebaaed1b
3 changed files with 59 additions and 36 deletions

View File

@@ -63,7 +63,8 @@ func init() {
[][2]string{
{
`{{ findRE "[G|g]o" "Hugo is a static side generator written in Go." "1" }}`,
`[go]`},
`[go]`,
},
},
)
@@ -87,7 +88,12 @@ func init() {
[][2]string{
{
`{{ replace "Batman and Robin" "Robin" "Catwoman" }}`,
`Batman and Catwoman`},
`Batman and Catwoman`,
},
{
`{{ replace "aabbaabb" "a" "z" 2 }}`,
`zzbbaabb`,
},
},
)
@@ -192,7 +198,6 @@ func init() {
)
return ns
}
internal.AddTemplateFuncsNamespace(f)