hughperkins / Jinja2CppLight

(very) lightweight version of Jinja2 for C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collections (as values) are unsupported

flexferrum opened this issue · comments

The library is the exactly what I need for my project, but I was really disappointed what collections (and iterations over collections) are unsupported as an value type.
Actually, it took me about ~4 hours to add such kind of support (and some other 'minor' improvements)... But dependency to boost::variant has also been added. It's suitable for my fork, but I'm not sure if it suitable for the upstream. From another standpoint, implementation has became more 'vanila' jinja2-conformed.

Cool that you've managed to add collections :)

As far as whether to merge it ... so ... when I think 'Light', I'm not sure Boost would come to mind :)

Happy to receive a pull request onto a descriptively-named branch.

boost::variant is extremely useful feature from boost. And quite light. But I think, I'll be able to make boost-free implementation with minimal backward-compatibility affect. From the my current version I completely remove the support of 'range' loops (it's became impossible to write: 'for i in range(10)' due to absence in Jinja 2 specs).
When I do it, I'll make a pull-request.

NB: Actually, I've decided to rewrite this library 'from the scratch' with supporting as much Jinja 2 features, as I can implement.

NB: Actually, I've decided to rewrite this library 'from the scratch' with supporting as much Jinja 2 features, as I can implement.

Ok, sounds good. The only thing you might want to be careful is you dont end up rewriting pythonc from scratch :P :D

Yeah, good concern. I'm also worrying about it. :)

Haha :) (This is why I went with lua in the end by the way)

:)
Actually, as far, as I can understand from the Jinja docs, the syntax of templates isn't a rocket science and simpler than syntax of Python. So, it shouldn't be a big problem.

If you are interested in, here is my version of jinja2 templates implementation
https://github.com/flexferrum/Jinja2Cpp