]> Cypherpunks repositories - gostls13.git/commit
text/template: allow using -}} with many spaces
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 20 Mar 2019 15:47:56 +0000 (15:47 +0000)
committerRob Pike <r@golang.org>
Sun, 24 Mar 2019 09:06:14 +0000 (09:06 +0000)
commite770b5b3aa9a2b6a7dcdc95cacd7ad3940ad34c9
treebd3ebf0bee7f66d893e4a5a0a6e9416223ed1851
parentb434bbf197b3683643d4d6b52bca687982e336b5
text/template: allow using -}} with many spaces

lexSpace consumed all spaces, even if the last one was part of a right
delimiter like " -}}". Thus, "3  -}}" wouldn't lex as "3" and a right
delimiter, but as "3", "-", and "}}".

To fix that, make lexSpace stop if it encounters a right delimiter.

Fixes #30948.

Change-Id: I80a5546e5809e54f6823e2bf3a57a7e8808329be
Reviewed-on: https://go-review.googlesource.com/c/go/+/168457
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
src/text/template/parse/lex.go
src/text/template/parse/parse_test.go