Skip to content

Comment on Using the C preprocessor as an HTML templating engineparent

Comments

Check out https://github.com/logological/gpp it's what I use when I feel like I need a preprocessor. It's more flexible in syntax and operation than cpp.

I've used it in the past for wrangling the definitions of a multitude of SQL triggers I was using to generate a real-time materialized view. The fact that you can modify its syntax is very helpful for making it work with non-C syntaxes (like SQL or even LaTeX).

It even has an HTML mode built-in, which you can customize to your needs, but looks like:

    <#define x|y>
    <#macro arg|...>
which works better for certain WYSIWYG editors. You could modify the syntax to be
    <!--#define x y-->
    <!--#macro(arg, ...)-->

Thanks for sharing! Looks just like what I need :-)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.