There's a ifconfig
sphinx extension -- and it allows for conditional inclusion of content. I'm looking for a way to conditionally include extensions. My best try is just to give a list of extensions with a -D
option to sphinx-build
:
sphinx-build -b singlehtml -d _build/doctrees -D html_theme=empty -D "extensions=['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.numfig', 'sphinx.ext.ifconfig', 'cloud_sptheme.ext.table_styling', 'sphinx.ext.htmlmath']" . _build/wkA
but it doesn't work.
The problem is to conditionally include sphinx.ext.htmlmath
or sphinxcontrib.mathml
.
Use -t <tag>
http://sphinx-doc.org/invocation.html#cmdoption-sphinx-build-t
e.g. Invoke sphinx like this (See -t use_htmlmath
):
sphinx-build -b singlehtml -d _build/doctrees \
-D html_theme=empty -t use_htmlmath . _build/wkA
Have this code in conf.py
if tags.has('use_htmlmath'):
# use supplied =t use_htmlmath
extensions.append('sphinx.ext.htmlmath')
else:
#fall back
extensions.append('sphinxcontrib-mathml')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With