mirror of https://github.com/golang/go.git
text/template: fix doc spacing
Change-Id: I4550ce3135b3cd675010a3701618e9350f282453
GitHub-Last-Rev: d2e52f1496
GitHub-Pull-Request: golang/go#68519
Reviewed-on: https://go-review.googlesource.com/c/go/+/599535
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
00cb41e14d
commit
e061fb89e8
|
|
@ -162,37 +162,55 @@ An argument is a simple value, denoted by one of the following.
|
||||||
the host machine's ints are 32 or 64 bits.
|
the host machine's ints are 32 or 64 bits.
|
||||||
- The keyword nil, representing an untyped Go nil.
|
- The keyword nil, representing an untyped Go nil.
|
||||||
- The character '.' (period):
|
- The character '.' (period):
|
||||||
|
|
||||||
.
|
.
|
||||||
|
|
||||||
The result is the value of dot.
|
The result is the value of dot.
|
||||||
- A variable name, which is a (possibly empty) alphanumeric string
|
- A variable name, which is a (possibly empty) alphanumeric string
|
||||||
preceded by a dollar sign, such as
|
preceded by a dollar sign, such as
|
||||||
|
|
||||||
$piOver2
|
$piOver2
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
$
|
$
|
||||||
|
|
||||||
The result is the value of the variable.
|
The result is the value of the variable.
|
||||||
Variables are described below.
|
Variables are described below.
|
||||||
- The name of a field of the data, which must be a struct, preceded
|
- The name of a field of the data, which must be a struct, preceded
|
||||||
by a period, such as
|
by a period, such as
|
||||||
|
|
||||||
.Field
|
.Field
|
||||||
|
|
||||||
The result is the value of the field. Field invocations may be
|
The result is the value of the field. Field invocations may be
|
||||||
chained:
|
chained:
|
||||||
|
|
||||||
.Field1.Field2
|
.Field1.Field2
|
||||||
|
|
||||||
Fields can also be evaluated on variables, including chaining:
|
Fields can also be evaluated on variables, including chaining:
|
||||||
|
|
||||||
$x.Field1.Field2
|
$x.Field1.Field2
|
||||||
- The name of a key of the data, which must be a map, preceded
|
- The name of a key of the data, which must be a map, preceded
|
||||||
by a period, such as
|
by a period, such as
|
||||||
|
|
||||||
.Key
|
.Key
|
||||||
|
|
||||||
The result is the map element value indexed by the key.
|
The result is the map element value indexed by the key.
|
||||||
Key invocations may be chained and combined with fields to any
|
Key invocations may be chained and combined with fields to any
|
||||||
depth:
|
depth:
|
||||||
|
|
||||||
.Field1.Key1.Field2.Key2
|
.Field1.Key1.Field2.Key2
|
||||||
|
|
||||||
Although the key must be an alphanumeric identifier, unlike with
|
Although the key must be an alphanumeric identifier, unlike with
|
||||||
field names they do not need to start with an upper case letter.
|
field names they do not need to start with an upper case letter.
|
||||||
Keys can also be evaluated on variables, including chaining:
|
Keys can also be evaluated on variables, including chaining:
|
||||||
|
|
||||||
$x.key1.key2
|
$x.key1.key2
|
||||||
- The name of a niladic method of the data, preceded by a period,
|
- The name of a niladic method of the data, preceded by a period,
|
||||||
such as
|
such as
|
||||||
|
|
||||||
.Method
|
.Method
|
||||||
|
|
||||||
The result is the value of invoking the method with dot as the
|
The result is the value of invoking the method with dot as the
|
||||||
receiver, dot.Method(). Such a method must have one return value (of
|
receiver, dot.Method(). Such a method must have one return value (of
|
||||||
any type) or two return values, the second of which is an error.
|
any type) or two return values, the second of which is an error.
|
||||||
|
|
@ -200,16 +218,22 @@ An argument is a simple value, denoted by one of the following.
|
||||||
and an error is returned to the caller as the value of Execute.
|
and an error is returned to the caller as the value of Execute.
|
||||||
Method invocations may be chained and combined with fields and keys
|
Method invocations may be chained and combined with fields and keys
|
||||||
to any depth:
|
to any depth:
|
||||||
|
|
||||||
.Field1.Key1.Method1.Field2.Key2.Method2
|
.Field1.Key1.Method1.Field2.Key2.Method2
|
||||||
|
|
||||||
Methods can also be evaluated on variables, including chaining:
|
Methods can also be evaluated on variables, including chaining:
|
||||||
|
|
||||||
$x.Method1.Field
|
$x.Method1.Field
|
||||||
- The name of a niladic function, such as
|
- The name of a niladic function, such as
|
||||||
|
|
||||||
fun
|
fun
|
||||||
|
|
||||||
The result is the value of invoking the function, fun(). The return
|
The result is the value of invoking the function, fun(). The return
|
||||||
types and values behave as in methods. Functions and function
|
types and values behave as in methods. Functions and function
|
||||||
names are described below.
|
names are described below.
|
||||||
- A parenthesized instance of one the above, for grouping. The result
|
- A parenthesized instance of one the above, for grouping. The result
|
||||||
may be accessed by a field or map key invocation.
|
may be accessed by a field or map key invocation.
|
||||||
|
|
||||||
print (.F1 arg1) (.F2 arg2)
|
print (.F1 arg1) (.F2 arg2)
|
||||||
(.StructValuedMethod "arg").Field
|
(.StructValuedMethod "arg").Field
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue