Templating in Go
austingwalters.com
austingwalters.com
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>
.It reads a lot like mustache, but has the power of a language that allows you to mix markup and code. Its worth checking out in more detail.
1. https://sites.google.com/site/usfcomputerscience/django-temp...
2. http://stackoverflow.com/questions/11467731/is-it-possible-t...
(plug for own library)
This is really useful when dealing with systems like Angular.js, which also use "{{foo}}" as delimiters for injecting directives.
[0] https://github.com/ChimeraCoder/go-angular-jetpack/blob/mast...