Get page-count into the document

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

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?