AppyPrinciplesGetting started
appy.pod Command-line programs osub.py - Preparing sub-pod templates

If ...

  • you have a main ODT pod template that imports a sub-pod template via a do ... from pod statement,
  • you use Renderer attribute managePageStyles with a value being an integer number, because you need to force page numbering from pages imported from sub-pod templates, 

Then ... 

  • page styles must be explicitly set on your pod template.

Set a page style manually

By default, LibreOffice (LO) does not explicitly set the page style in a document. If you want to do it manually, open your sub-pod template, and, in the Styles sidebar, double-click on the desired page style. LO will define, on the first paragraph from the current page, a page break flagged with the selected page style. In the following example, I just created a complex sub-pod template: the page style is not explicitly set.

Indeed, if I check the first paragraph's parameters, no page break is set.

If I open the Styles sidebar and double-click on the default page style, nothing seems to happen.

But, behind the scenes, LO has applied a page break to the first paragraph.

Set a page style using osub.py

If you want to ensure a sub-pod template has a default page style being explicitly set, osub.py is made for you. When calling osub.py with, as arg, the absolute path to a sub-pod-template:

  • if no default page style is explicitly applied, it will add, to the first paragraph of the first page, a page break being similar to the one added by LO when applying the page style manually, as in the example of the previous section,
  • if a page style is already set, osub.py will leave the file untouched.

Reference

All program options are documented hereafter.

usage: osub.py [-h] [-c] path
 
positional arguments:
  path         is the path to the odt file to update or check. When importing,
               via a do...pod statement, a sub-pod template into a main one,
               using parameter "managePageStyles" being an integer value, page
               styles must explicitly be defined in the sub-pod template. If
               it is not the case on the passed file, the default page style
               will explicitly be set (on the first document paragraph).
 
optional arguments:
  -h, --help   show this help message and exit
  -c, --check  set this option if you want to check the explicit presence of
               page styles in the file, without performing any actual change
               on it.