Skip to content

Commit

Permalink
Add DOM class for autosummary tables, only apply wrapping behavior to…
Browse files Browse the repository at this point in the history
… their descendent tds (#211)
  • Loading branch information
bollwyvl authored and jorisvandenbossche committed Aug 28, 2020
1 parent 5ad65a4 commit 6bc74c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pydata_sphinx_theme/bootstrap_html_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from sphinx.writers.html5 import HTML5Translator
from sphinx.util import logging
from sphinx.ext.autosummary import autosummary_table

logger = logging.getLogger(__name__)

Expand All @@ -28,6 +29,11 @@ def visit_table(self, node):
self._table_row_index = 0

classes = [cls.strip(" \t\n") for cls in self.settings.table_style.split(",")]

# we're looking at the 'real_table', which is wrapped by an autosummary
if isinstance(node.parent, autosummary_table):
classes += ["autosummary"]

# classes.insert(0, "docutils") # compat
# if 'align' in node:
# classes.append('align-%s' % node['align'])
Expand Down
2 changes: 1 addition & 1 deletion pydata_sphinx_theme/static/css/index.css

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ table.field-list {
* Styling for autosummary tables
*/

// The first column (with the signature) should not wrap
td:first-child {
white-space: nowrap;
.table.autosummary {
// The first column (with the signature) should not wrap
td:first-child {
white-space: nowrap;
}
}

/**
Expand Down

0 comments on commit 6bc74c5

Please sign in to comment.