Lightweight template engine
Written by Walter on 14/3/2012
Just bumped into this @ work (template engine bug on an embedded device at option).
Remembering the baseml template engine we wrote way back in early 2001-2002 called BaseML. Turns out it still compiles (apart from some using namespace std's missing).
Download the fixed sources here (ow yes commented out some procbuf.h code used only when you have php stuff, but this could be replaced with popen on os x/darwin)
- Alpha sources (well all works except the php stuff which you normally don't use on an embedded device): baseml-0.4a.tar.gz
- Original 2002 sources here
- OS X binary here: baseml
Basically with this template language you can define functions with parameters in xml and call them. With the baseml executable you can create static html files from it.
Little example hello.bml as input:
When running baseml on this above snippet, it generates the following output (in essence it's something like the modern jinja or other template engines. But this was done way back in early 2000's.
<?xml version="1.0"?> <document> <world> World! </world> <myOwnFunction> Hello
</myOwnFunction> <main> <myOwnFunction/> </main> </document>
There is a load of documentation and tutorials here on the wayback machine: baseml tutorial Cheers...
Walter-Schrepperss-MacBook-Pro:baseml-0.4a wschrep$ baseml/baseml hello.bml <!-- Generated with BaseML v0.3 --> Hello World! <!-- Generated in 0 (virtual) seconds -->