Skip to main content
`Ctrl`+`K`

# 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)

  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.

  depart_table(node)

    Custom depart_table method to close the scrollable div we add in visit_table.

  starttag(*args, **kwargs)

    Perform small modifications to tags.

    - ensure aria-level is set for any tag with heading role

  visit_table(node)

    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)

  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