AppyPrinciplesappy.pod
appy.pod Command-line programs oclean.py - Cleaning POD templates

POD misuses notes (comments) to insert Python code in it. LibreOffice allows to put formatting within these notes. Such formatting may break the code. oclean.py allows to remove any formatting within such notes.

oclean can be called on a single POD template, be it an ODS or an ODT template, or on a folder. In this latter case, formatting is cleaned in every note from any POD template found within this folder and, recursively, in any of its sub-folders.

Suppose you have a template called Agenda.odt, in some folder named pod. Cleaning this folder is achieved via the following command:

~/projets/appy/bin/oclean.py pod/Agenda.odt

The output cold be:

12 styled text part(s) unstyled.

Try to run it a second time:

~/projets/appy/bin/oclean.py pod/Agenda.odt

The output will be:

No cleaning occurred.

Indeed, everything was already cleaned.

To clean a complete folder hierarchy, run a command like this one:

~/projets/appy/bin/oclean.py .

The output could be::

159 styled text part(s) unstyled on 23 file(s).

The drawback is the relative violence of such cleaning. Personally, I usually format my ODF POD notes with a narrow font, like Ubuntu Narrow, in order to see more text in the reduced space offered by the note. Such global font formatting is also removed by oclean, although it does not prevent POD for workfing perfectly well.

The advantage is that oclean also fixes some illegal data structures (like bullets within notes) that may have been produced by old versions of LibreOffice or OpenOffice.

Reference

All program options are documented hereafter.

usage: oclean.py [-h] [-s] path
 
positional arguments:
  path          is the path to a file or folder. If a file is passed, you must pass the path to an ODF file
                (odt or ods): oclean will be run on this file only, removing any formatting found within
                its POD notes (comments). If a folder is passed, oclean will be run on all ODF files found
                in this folder and sub-folders.
 
optional arguments:
  -h, --help    show this help message and exit
  -s, --silent  to set if you want reduced output.