diff options
Diffstat (limited to 'src/text/template/doc.go')
-rw-r--r-- | src/text/template/doc.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/text/template/doc.go b/src/text/template/doc.go index 4b0efd2df8..7b30294336 100644 --- a/src/text/template/doc.go +++ b/src/text/template/doc.go @@ -40,16 +40,17 @@ More intricate examples appear below. Text and spaces By default, all text between actions is copied verbatim when the template is -executed. For example, the string " items are made of " in the example above appears -on standard output when the program is run. - -However, to aid in formatting template source code, if an action's left delimiter -(by default "{{") is followed immediately by a minus sign and ASCII space character -("{{- "), all trailing white space is trimmed from the immediately preceding text. -Similarly, if the right delimiter ("}}") is preceded by a space and minus sign -(" -}}"), all leading white space is trimmed from the immediately following text. -In these trim markers, the ASCII space must be present; "{{-3}}" parses as an -action containing the number -3. +executed. For example, the string " items are made of " in the example above +appears on standard output when the program is run. + +However, to aid in formatting template source code, if an action's left +delimiter (by default "{{") is followed immediately by a minus sign and white +space, all trailing white space is trimmed from the immediately preceding text. +Similarly, if the right delimiter ("}}") is preceded by white space and a minus +sign, all leading white space is trimmed from the immediately following text. +In these trim markers, the white space must be present: +"{{- 3}}" is like "{{3}}" but trims the immediately preceding text, while +"{{-3}}" parses as an action containing the number -3. For instance, when executing the template whose source is |