// predefinedEscapers contains template predefined escapers.
var predefinedEscapers = map[string]bool{
- "html" : true,
+ "html": true,
"urlquery": true,
"js": true,
}
for _, ident := range allIdents(idNode.Args[0]) {
if _, ok := predefinedEscapers[ident]; ok {
return context{
- state: stateError,
- err: errorf(ErrPredefinedEscaper, n, n.Line, "predefined escaper %q disallowed in template", ident),
+ state: stateError,
+ err: errorf(ErrPredefinedEscaper, n, n.Line, "predefined escaper %q disallowed in template", ident),
}
}
}
// the entire comment is considered to be a
// LineTerminator for purposes of parsing by
// the syntactic grammar."
- if bytes.IndexAny(s[written:i1], "\n\r\u2028\u2029") != -1 {
+ if bytes.ContainsAny(s[written:i1], "\n\r\u2028\u2029") {
b.WriteByte('\n')
} else {
b.WriteByte(' ')
// tURL is the context transition function for the URL state.
func tURL(c context, s []byte) (context, int) {
- if bytes.IndexAny(s, "#?") >= 0 {
+ if bytes.ContainsAny(s, "#?") {
c.urlPart = urlPartQueryOrFrag
} else if len(s) != eatWhiteSpace(s, 0) && c.urlPart == urlPartNone {
// HTML5 uses "Valid URL potentially surrounded by spaces" for