christopher-ramirez / secretary

Take the power of Jinja2 templates to OpenOffice and LibreOffice.
Other
190 stars 48 forks source link

Explain how to conditionally display a page in the doc #45

Open sametmax opened 7 years ago

sametmax commented 7 years ago

I have a document that may include a page or not. This page is using a different page style.

Right now I'm trying to do:

{% if condition %} <= this is at the beginning on the optional page
Optional page content
<Page break>
{% endif %} <= this is at the beginning on the next page

It partially works as the content is conditionally inserted. However, it's not inserted in a separate page, and the custom page style is lost.

sametmax commented 7 years ago

I've tried with different configurations, and actually it does work, only not when it's the first page that is optional.

christopher-ramirez commented 6 years ago

Well this is something I've never tried. Let me have a look into in.

christopher-ramirez commented 6 years ago

I've quickly tried a blank document, with its second page wrapped inside a condition. The technique:

{% if condition %} <= Before optional page
<Page break>
Optional page content
<Page break>
{% endif %} <= this is at the beginning on the next page

Hope this helps.

sametmax commented 6 years ago

As I said, it does work. But not for the First page with a set page style.

christopher-ramirez commented 6 years ago

Sorry! I didn't catch that

Right now it should not be possible to set the fist page as optional because there is where someone starts with the document.

I occurs to me that a solution would be introducing a new manual Control Flow reference which internally move the conditional block tag before/after the optional page.

sametmax commented 6 years ago

Ok thanks Le 06/09/2017 à 23:32, Christopher Ramírez a écrit :

Sorry! I didn't catch that

Right now it should not be possible to set the fist page as optional because there is where someone starts with the document.

I occurs to me that a solution would be introducing a new manual Control Flow https://github.com/christopher-ramirez/secretary#control-flow reference which internally move the conditional block tag before/after the optional page.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/christopher-ramirez/secretary/issues/45#issuecomment-327618506, or mute the thread https://github.com/notifications/unsubscribe-auth/ABmK3lbTrhXgcQyc51Tusoa6-hYc3EjHks5sfw-LgaJpZM4PHREh.