]> Cypherpunks repositories - gostls13.git/commit
text/template: allow newlines inside action delimiters
authorRuss Cox <rsc@golang.org>
Thu, 10 Sep 2020 22:53:26 +0000 (18:53 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 12 Oct 2020 16:30:36 +0000 (16:30 +0000)
commit9384d34c58099657bb1b133beaf3ff37ada9b017
treef1b31fd3061478b340178700e87b2a912aefc8bf
parent39b527691495902279da7ac8405a070ded7dd4a2
text/template: allow newlines inside action delimiters

This allows multiline constructs like:

{{"hello" |
  printf}}

Now that unclosed actions can span multiple lines,
track and report the start of the action when reporting errors.

Also clean up a few "unexpected <error message>" to be just "<error message>".

Fixes #29770.

Change-Id: I54c6c016029a8328b7902a4b6d85eab713ec3285
Reviewed-on: https://go-review.googlesource.com/c/go/+/254257
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/html/template/exec_test.go
src/text/template/doc.go
src/text/template/exec_test.go
src/text/template/parse/lex.go
src/text/template/parse/lex_test.go
src/text/template/parse/parse.go
src/text/template/parse/parse_test.go