• Samuel Tan's avatar
    html/template: use the same escaper across multiple template executions · a005a8d1
    Samuel Tan authored
    The escaper contains information about which templates have already been
    visited and escaped. This information is necessary to prevent templates
    that have already been escaped from being over-escaped. However, since we
    currently create a new escaper each time we execute a template, this
    information does not persist across multiple template executions.
    
    Fix this by saving an escaper in each template name space which is shared by
    all templates in that name space.
    
    While there, fix error message formatting for an escaping unit test.
    
    Fixes #20842
    
    Change-Id: Ie392c3e7ce0e0a9947bdf56c99e926e7c7db76e4
    Reviewed-on: https://go-review.googlesource.com/47256Reviewed-by: 's avatarMike Samuel <mikesamuel@gmail.com>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    a005a8d1
escape.go 28.5 KB