I use XQuery as static site generator. It is a w3c standard.
You just write the HTML and then it replaces $variables with data, e.g.:
<html><head>
<title>{$title}</title>
</head><body>
<h1>{$title}</h1>
<div class="main">{$content}</div>
...
It has for loops and functions, too