summaryrefslogtreecommitdiff
path: root/sphinx/writers
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-29 17:56:19 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-29 17:56:19 +0900
commit49063aa4ebf0bd115fb5cb32ea766fbcf69ccd67 (patch)
tree5b570968e225d334de529fc15f402e0e196bcffd /sphinx/writers
parent3b6b3e58014ecd6ab46b1320a907c82506e58352 (diff)
downloadsphinx-git-49063aa4ebf0bd115fb5cb32ea766fbcf69ccd67.tar.gz
Fix html: a width of table was ignored on HTML builder (ref: #6564)
Diffstat (limited to 'sphinx/writers')
-rw-r--r--sphinx/writers/html5.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/writers/html5.py b/sphinx/writers/html5.py
index f94dd60a3..80cedd3bd 100644
--- a/sphinx/writers/html5.py
+++ b/sphinx/writers/html5.py
@@ -734,11 +734,14 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
self._table_row_index = 0
+ atts = {}
classes = [cls.strip(' \t\n') for cls in self.settings.table_style.split(',')]
classes.insert(0, "docutils") # compat
if 'align' in node:
classes.append('align-%s' % node['align'])
- tag = self.starttag(node, 'table', CLASS=' '.join(classes))
+ if 'width' in node:
+ atts['style'] = 'width: %s' % node['width']
+ tag = self.starttag(node, 'table', CLASS=' '.join(classes), **atts)
self.body.append(tag)
def visit_row(self, node: Element) -> None: