
Steven Siloti skrev:
After reading the paper referenced in http://lists.boost.org/Archives/boost/2007/04/120230.php I decided to set about implementing something similar to it in C++.
You can see the current results here: http://magila.googlepages.com/template.zip
It uses Spirit for parsing and AST generation and Property Tree for storing the dynamic data. Still on my todo list is making the character type a template parameter, currently everything just uses char. Also expand() should probably be made a free function.
well, not for my sake.
Obviously the main interest is as a companion for the forthcoming cgi library. So what do you think? Interesting? Not?
Very interesting. We have implemented our own template engine, but I would much rather be using a well thought-out and heavily tested version from boost. I think it is quite amazing to see how a variety of boost libraries makes it so easy (or at least short) to implement something like this. Some comments: 1. call the class template_document or something similarly readable 2. see if it is possible to describe a minimal "tree" concept s.t. you can make the class work with other trees than property-tree. (it might be that you only need a small subset of the property-tree operations). -Thorsten