pydata_sphinx_theme.translator#

A custom Sphinx HTML Translator for Bootstrap layout.

Attributes#

logger

Classes#

BootstrapHTML5TranslatorMixin

Mixin HTML Translator for a Bootstrap-ified Sphinx layout.

Functions#

setup_translators(app)

Add bootstrap HTML functionality if we are using an HTML translator.

Module Contents#

class pydata_sphinx_theme.translator.BootstrapHTML5TranslatorMixin(*args, **kwds)[source]#

Mixin HTML Translator for a Bootstrap-ified Sphinx layout.

Only a couple of functions have been overridden to produce valid HTML to be directly styled with Bootstrap, and fulfill acessibility best practices.

starttag(*args, **kwargs)[source]#

Ensure an aria-level is set for any heading role.

visit_table(node)[source]#

Custom visit table method.

Copy of sphinx source to not add ‘docutils’ and ‘align-default’ classes but add ‘table’ class.

pydata_sphinx_theme.translator.setup_translators(app)[source]#

Add bootstrap HTML functionality if we are using an HTML translator.

This re-uses the pre-existing Sphinx translator and adds extra functionality defined in BootstrapHTML5TranslatorMixin. This way we can retain the original translator’s behavior and configuration, and _only_ add the extra bootstrap rules. If we don’t detect an HTML-based translator, then we do nothing.

Parameters:

app (sphinx.application.Sphinx)

pydata_sphinx_theme.translator.logger[source]#