pydata_sphinx_theme.translator
#
A custom Sphinx HTML Translator for Bootstrap layout.
Module Contents#
Classes#
Mixin HTML Translator for a Bootstrap-ified Sphinx layout. |
Functions#
|
Add bootstrap HTML functionality if we are using an HTML translator. |
Attributes#
- 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]#
Perform small modifications to tags.
ensure aria-level is set for any tag with heading role
ensure <pre> tags have tabindex=”0”.
- 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)