Write templates in C preprocessor language.
./cppt -D'TITLE="cppt_demo_#1"' -D'USERS(u)=u("Jesus",2015)u("Alice",17)u("Max",-1)' <example/example.cppt
The output is a chunk of HTML:
And here is what the template itself looks like:
Cppt template files must
html symbol as a string - the result of applying the template.
A few primitives are built in.
t(tag, attributes, content)
Creates a tag with given attributes and content.
Creates a void (a.k.a. self-closing) tag with no content.
Creates an attribute. Can be combined with other attributes to form the
attributes string containing all of them.
Usage: cppt [-D<definition>]... <TEMPLATE
Definitions have to be in exactly the same format as described in GCC(1).
Note: to pass a sequence of objects, you create a definition that accepts another macro, applies it to each object in a sequence and then concatenates the results. See the example.