Create different documents from the same ReST sources (conditional text)
-
Install Sphinx, and make:
Terminal window $ sudo apt install python-sphinx make -
Create a Sphinx project using the default options:
Terminal window $ sphinx-quickstart -
Add the following content to the
index.rstfile, maintaining the correct indentations:.. only:: electrician.. admonition:: Danger for electriciansRisk of electric shockDo not touch electrical wires... only:: plumber.. admonition:: Danger for plumbersRisk of drowningDo not dive into the pool. -
To control the display of content intended for electricians or plumbers, uncomment or comment the following lines in the
conf.pyconfiguration file:tags.add('electrician')tags.add('plumber') -
Generate your content:
Terminal window $ make html -
Open the
_build/html/index.htmlfile in a browser to view your content.