pptx-template icon indicating copy to clipboard operation
pptx-template copied to clipboard

[Improvement] use Jinja2 templating scheme

Open moutonjr opened this issue 7 years ago • 2 comments

Hi, thank you for your work, this is indeed VERY helpful.

This could be great to turn tempalting scheme into Jinja2 one (http://jinja.pocoo.org/docs/2.10/)

The best feature could be case control and iteration with Jinja, just like (in a PPTX file) :


----
Here are the list of to-dos : 

{% for entry in hello.entries %}
-  TODO: {{entry}}
{%endfor%}

moutonjr avatar May 30 '18 10:05 moutonjr

@moutonjr I don't know, but I think it's easier to do it at the Python level,

let's say so:

pptx.app(slide(
   template='template_name',  # Slide id
   data={
       'hello': { 
           'entries': [1, 2, 3, 4]   
       }
   }
))

.pptx is not html :(

skar404 avatar May 30 '18 13:05 skar404

For Jinja2 template scheme, see https://github.com/kwlo/python-pptx-templater.

@skar404 Doing this at a Python level will not create the desired number or row in a table. I don't think that pptx-template will generate as many rows as you specified in the entries list.

Thykof avatar Jun 19 '20 08:06 Thykof