mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
+69
-54
@@ -38,28 +38,6 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.CountRunes,
|
||||
[]string{"countrunes"},
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.RuneCount,
|
||||
nil,
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.CountWords,
|
||||
[]string{"countwords"},
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Count,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ "aabab" | strings.Count "a" }}`, `3`},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Contains,
|
||||
nil,
|
||||
[][2]string{
|
||||
@@ -76,6 +54,33 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.ContainsNonSpace,
|
||||
nil,
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Count,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ "aabab" | strings.Count "a" }}`, `3`},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.CountRunes,
|
||||
[]string{"countrunes"},
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.CountWords,
|
||||
[]string{"countwords"},
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Diff,
|
||||
nil,
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.FindRE,
|
||||
[]string{"findRE"},
|
||||
[][2]string{
|
||||
@@ -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,6 +236,11 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.TrimSpace,
|
||||
nil,
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.TrimSuffix,
|
||||
nil,
|
||||
[][2]string{
|
||||
@@ -205,21 +249,6 @@ 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.FirstUpper,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ "hugo rocks!" | strings.FirstUpper }}`, `Hugo rocks!`},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Truncate,
|
||||
[]string{"truncate"},
|
||||
[][2]string{
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user