From 3d4fc8c47cae2d8c5c5b85015e7ca2ff5ed2e41b Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 4 Mar 2019 22:47:28 +0900 Subject: [PATCH] ``math`` directive does not support ``:class:`` option ``:class:`` option is a common options for all directives. But our implementation does not support it so far. This adds support for the option. --- CHANGES | 1 + sphinx/directives/patches.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index e8721e5cb..6d63bd8d4 100644 --- a/CHANGES +++ b/CHANGES @@ -49,6 +49,7 @@ Features added * Add a helper class ``sphinx.transforms.post_transforms.SphinxPostTransform`` * Add a helper method ``SphinxDirective.set_source_info()`` * #6180: Support ``--keep-going`` with BuildDoc setup command +* ``math`` directive now supports ``:class:`` option Bugs fixed ---------- diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py index ee8014aa6..c102f3461 100644 --- a/sphinx/directives/patches.py +++ b/sphinx/directives/patches.py @@ -165,6 +165,7 @@ class MathDirective(SphinxDirective): option_spec = { 'label': directives.unchanged, 'name': directives.unchanged, + 'class': directives.class_option, 'nowrap': directives.flag, } @@ -175,6 +176,7 @@ class MathDirective(SphinxDirective): latex = self.arguments[0] + '\n\n' + latex label = self.options.get('label', self.options.get('name')) node = nodes.math_block(latex, latex, + classes=self.options.get('class', []), docname=self.env.docname, number=None, label=label,