I'm currently working on a c++ application to allow the use to fill some kind of database, possibly with some logic embeded as scripted expressions, and then use models to export documents.

It's rather simple, and quite similar to a CMS, but as a desktop app to create documents.

Great, so far I was using ruby and ERB as scripting and template engines, but I'd like to migrate to python, as the python c api is more flexible, there are great library for interoperability between python and c++ (I use pybind11) and for a few other reasons.

I'm looking for a template engine to replace erb. I found out jinja2 but apparently it has this philosophy that "logic is for the controller", which reduce the usability and acessibility of functions in the template.

Problem is, I use functions to pass datas around from c++ to the template.

I wonder if coding some compiler for some simple template code to python wouldn't be a better idea. What do you think ? It wouldn't be that hard, as I don't have to bother about all the things traditional template engines have to worry about. (And it would be easier to distribute later).

What do you think ? I am missing some other python template engine that could be better suited in that case ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.