Re: Get page-count into the document

Posted by mojavelinux on
URL: https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296p8297.html

If you want to ensure that each chapter starts on the same side, then you need to set media=prepress (automatic facing pages). See https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#prepress

And no, you cannot access the page count using an AsciiDoc attribute reference. But I wouldn't recommend what you are trying to do anyway since you are mixing content and presentation. It would be better to use an extension like a tree processor if media=prepress doesn't give you what you need.

Best Regards,

-Dan

On Tue, Oct 27, 2020 at 2:59 AM TonK [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm creating a large document that consists of multiple files (chapters) that are included. This document is a training with text on the left page explaining a picture that is on the right page. When one of the chapters has an odd number of pages the left/right requirements is messed up. So the picture is on the left and explaining text is on the previous pages, that you can't see. So I have to ensure that every chapter has an even number of pages.

I tried:

----
iifeval::[{page-count} / 2 != 0]

<<<

{emty} +
endif::[]
----

But that doesn;t work as the `page-count` is not available in the document.

Is there any way to ensure the number of pages is even?


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux