@@ -93,12 +93,14 @@ var htmlNormReplacementTable = []string{
93
93
// <div id=d></div>
94
94
// <script>(function () {
95
95
// var a = [], d = document.getElementById("d"), i, c, s;
96
- // for (i = 0; i < 0x10000; ++i) {
97
- // c = String.fromCharCode(i);
98
- // d.innerHTML = "<span title=" + c + "lt" + c + "></span>"
99
- // s = d.getElementsByTagName("SPAN")[0];
100
- // if (!s || s.title !== c + "lt" + c) { a.push(i.toString(16)); }
101
- // }
96
+ //
97
+ // for (i = 0; i < 0x10000; ++i) {
98
+ // c = String.fromCharCode(i);
99
+ // d.innerHTML = "<span title=" + c + "lt" + c + "></span>"
100
+ // s = d.getElementsByTagName("SPAN")[0];
101
+ // if (!s || s.title !== c + "lt" + c) { a.push(i.toString(16)); }
102
+ // }
103
+ //
102
104
// document.write(a.join(", "));
103
105
// })()</script>
104
106
var htmlNospaceReplacementTable = []string {
@@ -335,7 +337,9 @@ func (c context) mangle(templateName string) string {
335
337
// HTML5 parsing algorithm because a single token production in the HTML
336
338
// grammar may contain embedded actions in a template. For instance, the quoted
337
339
// HTML attribute produced by
338
- // <div title="Hello {{.World}}">
340
+ //
341
+ // <div title="Hello {{.World}}">
342
+ //
339
343
// is a single token in HTML's grammar but in a template spans several nodes.
340
344
type state uint8
341
345
@@ -936,13 +940,19 @@ func newIdentCmd(identifier string, pos parse.Pos) *parse.CommandNode {
936
940
// nudge returns the context that would result from following empty string
937
941
// transitions from the input context.
938
942
// For example, parsing:
939
- // `<a href=`
943
+ //
944
+ // `<a href=`
945
+ //
940
946
// will end in context{stateBeforeValue, attrURL}, but parsing one extra rune:
941
- // `<a href=x`
947
+ //
948
+ // `<a href=x`
949
+ //
942
950
// will end in context{stateURL, delimSpaceOrTagEnd, ...}.
943
951
// There are two transitions that happen when the 'x' is seen:
944
952
// (1) Transition from a before-value state to a start-of-value state without
945
- // consuming any character.
953
+ //
954
+ // consuming any character.
955
+ //
946
956
// (2) Consume 'x' and transition past the first value character.
947
957
// In this case, nudging produces the context after (1) happens.
948
958
func nudge (c context ) context {
@@ -1973,14 +1983,17 @@ type ErrorCode int
1973
1983
//
1974
1984
// Output: "ZgotmplZ"
1975
1985
// Example:
1976
- // <img src="{{.X}}">
1977
- // where {{.X}} evaluates to `javascript:...`
1986
+ //
1987
+ // <img src="{{.X}}">
1988
+ // where {{.X}} evaluates to `javascript:...`
1989
+ //
1978
1990
// Discussion:
1979
- // "ZgotmplZ" is a special value that indicates that unsafe content reached a
1980
- // CSS or URL context at runtime. The output of the example will be
1981
- // <img src="#ZgotmplZ">
1982
- // If the data comes from a trusted source, use content types to exempt it
1983
- // from filtering: URL(`javascript:...`).
1991
+ //
1992
+ // "ZgotmplZ" is a special value that indicates that unsafe content reached a
1993
+ // CSS or URL context at runtime. The output of the example will be
1994
+ // <img src="#ZgotmplZ">
1995
+ // If the data comes from a trusted source, use content types to exempt it
1996
+ // from filtering: URL(`javascript:...`).
1984
1997
const (
1985
1998
// OK indicates the lack of an error.
1986
1999
OK ErrorCode = iota
@@ -3523,6 +3536,7 @@ func (t *Template) Lookup(name string) *Template {
3523
3536
// Must is a helper that wraps a call to a function returning (*Template, error)
3524
3537
// and panics if the error is non-nil. It is intended for use in variable initializations
3525
3538
// such as
3539
+ //
3526
3540
// var t = template.Must(template.New("name").Parse("html"))
3527
3541
func Must (t * Template , err error ) * Template {
3528
3542
if err != nil {
0 commit comments