]> Cypherpunks repositories - gostls13.git/commit
text/template: add a slice function to the predefined global functions
authorAriel Mashraki <ariel@mashraki.co.il>
Sun, 10 Feb 2019 20:44:03 +0000 (22:44 +0200)
committerRob Pike <r@golang.org>
Thu, 23 May 2019 08:01:24 +0000 (08:01 +0000)
commite2970a4591084d25c8bbd3e0648f8228f9defa2e
treee91f640aac9ffaa80f04fcd8b1108992bdf78e6e
parent6f51082da77a1d4cafd5b7af0db69293943f4066
text/template: add a slice function to the predefined global functions

The new slice function returns the result of slicing its first argument by
the following arguments. Thus {{slice x 1 3}} is, in Go syntax, x[1:3].
Each sliced item must be a string, slice, or array.

Closed #30153

RELNOTE=yes

Change-Id: I63188c422848cee3d383a64dc4d046e3a1767c63
Reviewed-on: https://go-review.googlesource.com/c/go/+/161762
Reviewed-by: Rob Pike <r@golang.org>
src/text/template/doc.go
src/text/template/exec_test.go
src/text/template/funcs.go