> “I wrote the initial version of Pollen in Python. I devised a simplified markup-notation language for the source files. This language was compiled into XML-ish data structures using ply (Python lex/yacc). These structures were parsed into trees using LXML. The trees were combined with templates made in Chameleon. These templates were rendered and previewed with the Bottle web server.
> “Did it work? Sort of. Source code went in; web pages came out. But it was also complicated and fragile. Moreover, though the automation was there, there wasn’t yet enough abstraction at the source layer. I started thinking about how I could add a source preprocessor.”
[1] https://docs.racket-lang.org/pollen/Backstory.html#%28part._...
It's a pretty neat system and worth learning before you head off to invent your own wheel.
In general, you'll want javascript-assisted solutions working in the browser, and then some pre-processing in Python, depending on your needs.
In particular, what I dislike about all other static generators is they come with their own templating language, which is usually limited, stupid and broken in various ways. I just want to mix Python and Markdown, but have the code replaced with its output, to make it easy to build more complicated structures.
Maybe I'll just write something myself...