Don’t ask me why, but I needed a simple HTML template library for C++. I looked at a few of them, but there wasn’t a clear winner. Most were too heavyweight, hard to build or I didn’t like the syntax.
So I decided to write my own. How hard can it be?
NLTemplate is really simple. It comes in a single source file, has no extra dependencies and you can just drop it in your project and it will work. It does variable replacement, optional or repeatable blocks and file includes. You can define your own file loader to deal with path resolution and file I/O. To insert a variable, you write {{ variable }}, to define a block, you write {% block name %} and then end it with {% endblock %}.
Get the source code here.