Skip to content

text/template: add a slice function to the predefined global functions  #30153

@a8m

Description

@a8m

I'm suggesting to add a function named slice to the predefined global functions under the text/template package that will mimic the slice expression in Go.

Calling slice 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions