soupault

Soupault is an HTML manipulation tool. It can be a static site generator
or an HTML (post-)processor for existing websites and allows you to define your own content model
and page processing rules using built-in actions, external executables, templates, or Lua plugins.
Soupault works with the HTML element tree of the page, so it can do many things that traditionally could be done with client-side JS:
inject new HTML into existing complete pages, create a table of contents that respects and uses id's of HTML headings and more.
It also doesn't use front matter but extracts metadata from HTML instead: you tell it what to extract using CSS3 selectors,
so even hand-written static pages can be indexed rather than treated as opaque assets.
For example, here's what a content model for a blog may look like:
# Post title
[index.fields.title]
# Try to find <h1 id="post-title">,
# else use the first <h1>
selector = ["h1#post-title", "h1"]
# Fail the build if post title cannot be found
required = true
# Post excerpt