Add ability to use pongo2 as an alternative to Go Template #254
+263
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is more a proposal than a finished pull request—I wanted to gauge interest and get feedback on the implementation before I started writing tests and updating documentation.
pongo2 is a Go template engine that has a Django/Jinja2-style syntax. My interest in having this available as an option—besides personal preference—is that my development team at The Atlantic is very familiar with the syntax of jinja2, but less so with Go templates. It seems like there might also be others interested in this as well (e.g. #177).
In addition to adding the ability to use pongo2 as the template engine (either with the
-engine pongo2
CLI flag or withengine = "pongo2"
in a config file) I've ported the existing example templates to pongo2.I was tempted to make the functions and context variables all lowercase / underscore-separated to make them more idiomatic for Django-style templates, but I thought that might be a bridge too far.