I am looking for a template engine that satisfies the following requirements:
General-purpose, i.e. not specialized for generating text in a specific language.
Must handle indentation well, i.e. it should be relatively easy to control the indentation structure of the output when writing templates while also using indentation for readability of the template language itself. The engine should be able to distinguish "template indentation" from "output indentation" and to intelligently strip the former when generating output.
Must be "literal text first", i.e. there must be no need to mark up "literal text" in any special way. This is a requirement satisfied by XML-like syntaxes among others, and emphatically NOT satisfied by pug-like syntaxes.
Must support some kind of section / yield constructs; most abstractly, it must be possible to:
- define named places / "extension points" in the output
- append to different named places defined in independent template files from one place in a template
- append from many places in templates to the same named place in the output
Planned application: generating Dockerfiles, nginx configs, and possibly other DSLs, to avoid tooling bloat of using a dedicated beautfier for each DSL.