I'm looking to find the easiest/most logical way of including sections conditionally within Sphinx-based documentation. The ``ifconfig`` extension works very well and allows flexible Python conditions inside the documentation, but it doesn't support 'nested headings' (eg sibling headings at the same level as ones previously defined). By contrast, in my testing, the ``only`` directive allows sibling headings correctly, but is limited to considering only configured tags from the conf.py configuration.
For instance, if I've got a page like this: My document > *********** > > First heading > ============= > This content is not optional > > .. ifconfig:: 'feature' in features > > Optional heading > ================ > > This content is optional. > > .. ifconfig:: 'feature2' in features > > Second optional heading > ======================= > > This content is optional. > this fails because the optional headings are considered unexpected in the given context. If I change the ``ifconfig`` over to use ``only``, and move the conditional statements into the conf.py file to configure specific tags, then everything works (including having the headings inside TOCs), but it's a little less flexible since the conditions are elsewhere & must pre-configured. Is this latter approach the best solution or is there another suggested solution? I'm using the latest version of Sphinx at the time of writing. Thanks! -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
