if e := equivEscapers[b]; e != "" { s = append(s, "html_template_htmlescaper") // escapeTree escapes the named template starting in the given context as for k, v := range e1.actionNodeEdits { // `"; case *parse.IfNode: "html" "html_template_jsvalescaper": jsValEscaper, newCmds = appendCmd(newCmds, id) b.WriteString("<") } func newEscaper(t *Template) *escaper { // Look for a fixed point by assuming c1 as the output context. p.Cmds = newCmds if cmd := p.Cmds[i]; len(cmd.Args) != 0 { n := len(p.Cmds) "html_template_attrescaper": true, err, c.err.Name = c.err, name b.WriteByte(' ') "html_template_jsregexpescaper": { } if _, ok := e.actionNodeEdits[n]; ok { actionNodeEdits map[*parse.ActionNode][]string c0.err.Line = n.Line "html_template_commentescaper": { "html_template_attrescaper": "html", var redundantFuncs = map[string]map[string]bool{ } } case delimSpaceOrTagEnd: func (e *escaper) escapeListConditionally(c context, n *parse.ListNode, filter func(*escaper, context) bool) (context, bool) { map[string]bool{}, if err != nil { func (e *escaper) editActionNode(n *parse.ActionNode, cmds []string) { return context{ // c1 is accurate if it matches our assumed output context. end := i1 return c } c1, i1 := transitionFunc[c.state](c, u) } t.text.Tree = nil e.editTextNode(k, v) }, // the identifiers in s in order. c := a } // escapeText escapes a text template node. func (e *escaper) editTextNode(n *parse.TextNode, text []byte) { panic(fmt.Sprintf("node %s shared between templates", n)) } } e1 := newEscaper(e.tmpl) return c s := make([]string, 0, 3) // The "true" branch of a "range" node can execute multiple times. // On exiting an attribute, we discard all state information } } // inferences in e if the inferences and output context satisfy filter. if e := join(c, d, line, nodeName); e.state != stateError { copy(newCmds, p.Cmds) e.derived[dname] = dt } // join joins the two contexts of a branch template node. The result is an // In `= 0 { } return e.escapeBranch(c, &n.BranchNode, "with") return c0 dt := e.template(dname) "html_template_attrescaper": attrEscaper, i := bytes.IndexAny(s, delimEnds[c.delim]) func escapeTemplates(tmpl *Template, names ...string) error { switch n := n.(type) { func (e *escaper) commit() { "html_template_attrescaper": true, } Args: []parse.Node{parse.NewIdentifier(identifier)}, return context{state: stateTag, element: c.element}, i if c.state != c1.state && isComment(c1.state) && c1.delim == delimNone { // all content preceding it has been consumed. } // assumption was correct. case *parse.WithNode: if !isComment(c.state) || c.delim != delimNone { if bytes.IndexAny(s[written:i1], "\n\r\u2028\u2029") != -1 { //