mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7397 from tk0miya/6564_table_width
Fix html: a width of table was ignored on HTML builder (ref: #6564)
This commit is contained in:
commit
ac2987a7d3
1
CHANGES
1
CHANGES
@ -30,6 +30,7 @@ Bugs fixed
|
||||
different with one from ``index`` directive with "builtin" type
|
||||
* #7301: capital characters are not allowed for node_id
|
||||
* #7301: epub: duplicated node_ids are generated
|
||||
* #6564: html: a width of table was ignored on HTML builder
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user