mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
tpl: Cleanup strings.TrimPrefix and TrimSuffix
These funcs were added during the move to namespaces but were undocumented. This commit fixes the order of the arguments and adds the funcs to the method mapping.
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
7674ad7382
commit
29a2da0593
@@ -119,6 +119,14 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.TrimPrefix,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ "aabbaa" | strings.TrimPrefix "a" }}`, `abbaa`},
|
||||
{`{{ "aabbaa" | strings.TrimPrefix "aa" }}`, `bbaa`},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.TrimRight,
|
||||
nil,
|
||||
[][2]string{
|
||||
@@ -126,6 +134,14 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.TrimSuffix,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ "aabbaa" | strings.TrimSuffix "a" }}`, `aabba`},
|
||||
{`{{ "aabbaa" | strings.TrimSuffix "aa" }}`, `aabb`},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Title,
|
||||
[]string{"title"},
|
||||
[][2]string{
|
||||
|
Reference in New Issue
Block a user