7 ms·
Doesn't mention imho the best feature of Go html templating, from the docs (http://golang.org/pkg/html/template/ http://golang.org/pkg/html/template/): This pa
by troyk 12y ago
Doesn't mention imho the best feature of Go html templating, from the docs (http://golang.org/pkg/html/template/ http://golang.org/pkg/html/template/):
This package understands HTML, CSS, JavaScript, and URIs. It adds sanitizing functions to each simple action pipeline, so given the excerpt
<a href="/search?q={{.}}">{{.}}</a>
At parse time each {{.}} is overwritten to add escaping functions as necessary. In this case it becomes
<a href="/search?q={{. | urlquery}}">{{. | html}}</a>
.