Merge pull request #6197 from sphinx-doc/math_directive_should_support_classes

``math`` directive does not support ``:class:`` option
This commit is contained in:
Takeshi KOMIYA 2019-03-23 22:55:43 +09:00 committed by GitHub
commit 28a21cbf46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -50,6 +50,7 @@ Features added
* Add a helper class ``sphinx.transforms.post_transforms.SphinxPostTransform`` * Add a helper class ``sphinx.transforms.post_transforms.SphinxPostTransform``
* Add a helper method ``SphinxDirective.set_source_info()`` * Add a helper method ``SphinxDirective.set_source_info()``
* #6180: Support ``--keep-going`` with BuildDoc setup command * #6180: Support ``--keep-going`` with BuildDoc setup command
* ``math`` directive now supports ``:class:`` option
Bugs fixed Bugs fixed
---------- ----------

View File

@ -165,6 +165,7 @@ class MathDirective(SphinxDirective):
option_spec = { option_spec = {
'label': directives.unchanged, 'label': directives.unchanged,
'name': directives.unchanged, 'name': directives.unchanged,
'class': directives.class_option,
'nowrap': directives.flag, 'nowrap': directives.flag,
} }
@ -175,6 +176,7 @@ class MathDirective(SphinxDirective):
latex = self.arguments[0] + '\n\n' + latex latex = self.arguments[0] + '\n\n' + latex
label = self.options.get('label', self.options.get('name')) label = self.options.get('label', self.options.get('name'))
node = nodes.math_block(latex, latex, node = nodes.math_block(latex, latex,
classes=self.options.get('class', []),
docname=self.env.docname, docname=self.env.docname,
number=None, number=None,
label=label, label=label,