I want to do multiple versions of a documentation, which differ in the sections that are included. To achieve this I would usually use either the only directive or the ifcon
My solution is to place the conditional content in a separate directory 'intern' and using a tag 'internal'.
In conf.py I added the lines
if tags.has('internal'):
exclude_patters = ['_build']
else:
exclude_patterns = ['_build', 'intern*']
Now when I pass the 'internal' flag on the command line I get all, otherwise everything except the contents in the intern directory.
The tag internal can be used in combination with only.
The ToC contains references to intern/somedoc and they are included or skipped as required. I do get a number of warnings about missing pages but those can be silenced.