go/src
Rob Pike e6ee26a03b text/template: provide a way to trim leading and trailing space between actions
Borrowing a suggestion from the issue listed below, we modify the lexer to
trim spaces at the beginning (end) of a block of text if the action immediately
before (after) is marked with a minus sign. To avoid parsing/lexing ambiguity,
we require an ASCII space between the minus sign and the rest of the action.
Thus:

	{{23 -}}
	<
	{{- 45}}

produces the output
	23<45

All the work is done in the lexer. The modification is invisible to the parser
or any outside package (except I guess for noticing some gaps in the input
if one tracks error positions). Thus it slips in without worry in text/template
and html/template both.

Fixes long-requested issue #9969.

Change-Id: I3774be650bfa6370cb993d0899aa669c211de7b2
Reviewed-on: https://go-review.googlesource.com/14391
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-09 05:28:11 +00:00
..
archive archive/tar: don't treat multiple file system links as a tar hardlink 2015-08-04 17:34:43 +00:00
bufio bufio: Remove unneeded error initialization 2015-07-18 18:05:23 +00:00
builtin builtin: remove errant space in hyphenated adjective phrase 2015-06-28 21:41:38 +00:00
bytes bytes: improve Compare function on amd64 for large byte arrays 2015-08-26 03:52:20 +00:00
cmd cmd/dist, cmd/link: force external linking for shared libs on arm 2015-09-09 01:42:22 +00:00
compress compress/lzw: tidy up some flush calls. 2015-09-09 01:45:00 +00:00
container
crypto crypto/x509: emit PKIX names in a more standard order. 2015-08-30 15:34:48 +00:00
database/sql database/sql: close bad connections in commit or rollback: 2015-09-03 17:07:37 +00:00
debug all: remove executable bit from several files 2015-09-04 02:59:49 +00:00
encoding encoding/asn1: fix panic when Marshaling nil. 2015-08-29 18:53:41 +00:00
errors
expvar
flag flag: add comment stating that Set is called in sequence across the command line 2015-07-16 05:33:47 +00:00
fmt fmt: fix scientific notation in docs 2015-08-31 18:43:00 +00:00
go all: minor documentation tweaks for constants 2015-09-09 05:07:52 +00:00
hash hash: update documentation for MakeTable in crc32 and crc64 2015-09-04 02:16:27 +00:00
html html: speed up UnescapeString 2015-08-22 12:45:38 +00:00
image image/png: reject zero-width and zero-height images. 2015-09-09 02:53:58 +00:00
index/suffixarray
internal internal/syscall/windows/registry: do not panic when data is large 2015-09-04 04:47:26 +00:00
io io: add WriteString support to MultiWriter 2015-09-01 04:00:12 +00:00
log log: fix flaky test 2015-06-18 18:08:17 +00:00
math all: minor documentation tweaks for constants 2015-09-09 05:07:52 +00:00
mime mime: move examples to external test file 2015-08-22 18:39:29 +00:00
net net: Make Listen(":port") use IPv6 when IPv4 is not supported. 2015-09-05 02:31:22 +00:00
os os: remove a redundant branch in File.Read. 2015-08-31 04:42:04 +00:00
path all: fix some vet-caught formatting errors, mostly but not only in tests 2015-08-21 05:37:36 +00:00
reflect reflect: record unsafe.Pointer, not uintptr, during DeepEqual 2015-09-05 01:44:30 +00:00
regexp regexp: small correction to test comment 2015-06-14 17:09:13 +00:00
runtime runtime: add high-level description of how stack barriers work 2015-09-09 01:18:56 +00:00
sort sort: Fix typo in Stable() comment 2015-08-17 06:58:16 +00:00
strconv strconv: add QuoteToGraphic and friends 2015-09-08 17:33:17 +00:00
strings all: link to https for golang subdomains too 2015-07-12 04:42:40 +00:00
sync runtime, sync/atomic: add memory barriers in arm cas routines 2015-07-30 20:11:11 +00:00
syscall syscall: fix formatting calls in tests 2015-09-03 21:08:04 +00:00
testing testing/quick: terminate for arbitrary recursive types 2015-08-29 19:23:37 +00:00
text text/template: provide a way to trim leading and trailing space between actions 2015-09-09 05:28:11 +00:00
time time: fix 400 year offset in comment 2015-08-29 01:03:42 +00:00
unicode unicode: include rune 0 in RangeTables. 2015-08-24 15:05:48 +00:00
unsafe
Make.dist
all.bash
all.bat
all.rc
androidtest.bash androidtest.bash: robust cleanup in case of failure. 2015-07-17 21:12:12 +00:00
bootstrap.bash build: Fix bootstrap.bash for official source tarballs 2015-09-01 19:52:59 +00:00
buildall.bash
clean.bash build: clean current tree in clean.bash 2015-08-05 19:36:15 +00:00
clean.bat build: fix clean scripts 2015-06-18 16:13:13 +00:00
clean.rc build: fix clean scripts 2015-06-18 16:13:13 +00:00
iostest.bash
make.bash make.bash: abort if $GOROOT_BOOTSTRAP == $GOROOT 2015-08-24 03:04:52 +00:00
make.bat doc: replace references to {5..9}{g,l} with go tool compile and go tool link 2015-06-17 04:05:50 +00:00
make.rc doc: replace references to {5..9}{g,l} with go tool compile and go tool link 2015-06-17 04:05:50 +00:00
nacltest.bash
race.bash all: link to https instead of http 2015-07-11 14:36:33 +00:00
race.bat all: link to https instead of http 2015-07-11 14:36:33 +00:00
run.bash
run.bat
run.rc