<div dir="ltr"><div>Sorry for replying to my own post. I noticed something curious. When I uncommented: template2 = latex_jinja_env.get_template('test2.template') and run the python3 script again I now get jinja2.exceptions.TemplateSyntaxError: Unexpected end of template. Jinja was looking for the following tags: 'endblock'. The innermost block that needs to be closed is 'block'.</div><div><br></div><div>I think we might be very close!<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 28, 2020 at 7:47 PM Chris Caston <<a href="mailto:chris@caston.id.au">chris@caston.id.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Kirk,</div><div><br></div><div>Thank you for your excellent help.</div><div><br></div><div>I just realised I have been sending directly to you rather than posting to the list. <br></div><div><br></div><div>I have updated the file: test2.template:<br></div><div><br></div><div>\BLOCK{ extends "jinja-test.template" }<br><br>\BLOCK{block content}<br>This provides you some additional text from the child block.<br><br><br>\BLOCK{ block content }<br> My string: \VAR{my_string}<br><br><br><br>Loop through the list:<br>\begin{itemize}<br>\item<br>\BLOCK{ for n in my_list }<br>\VAR{n}<br>\BLOCK{ endfor }<br><br>\end{itemize}<br><br><br>\BLOCK{ endblock }</div><div><br></div><div>in jinja-test.template it now has:</div><div>\section{\VAR{section8}}<br><br>\BLOCK{block content}\BLOCK{endblock}<br><br>\end{document}</div><div><br></div><div>I have updated the files at: <a href="https://github.com/warmheartcoin/jinjalatex" target="_blank">https://github.com/warmheartcoin/jinjalatex</a></div><div><br></div><div><br></div><div>It still doesn't render the child template. Perhaps it can't find it?</div><div><br></div><div>Do I need load the template perhaps something like this? (from <a href="https://jinja.palletsprojects.com/en/2.10.x/api/" target="_blank">https://jinja.palletsprojects.com/en/2.10.x/api/</a>)</div><div><br></div><div><br></div><div><pre><span>from</span> <span>jinja2</span> <span>import</span> <span>Environment</span><span>,</span> <span>PackageLoader</span><span>,</span> <span>select_autoescape</span>
<span>env</span> <span>=</span> <span>Environment</span><span>(</span>
<span>loader</span><span>=</span><span>PackageLoader</span><span>(</span><span>'yourapplication'</span><span>,</span> <span>'templates'</span><span>),</span>
<span>autoescape</span><span>=</span><span>select_autoescape</span><span>([</span><span>'html'</span><span>,</span> <span>'xml'</span><span>])</span>
<span>)</span></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 28, 2020 at 3:08 PM Chris Caston <<a href="mailto:chris@caston.id.au" target="_blank">chris@caston.id.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thanks Kirk,</div><div><br></div><div>I will have another try at getting it to work based on your feedback soon. I also found the following on github which as been very helpful with a few examples. <a href="https://github.com/pappasam/latexbuild" target="_blank">https://github.com/pappasam/latexbuild</a></div><div>I was working on those examples last night but using his code copied into in mine and I felt I had almost got it to work but eventually had to give in to sleep.</div><div><br></div><div>I have also decided that I will open source the project that I am working on. It's the right thing to do (especially as everything I am using to build it is open source) and I hope to reveal more about the project soon.</div><div><br></div><div>best regards,</div><div><br></div><div>Christopher Caston<br></div><div><br></div></div>
</blockquote></div>
</blockquote></div>