summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-07 01:22:10 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-07 01:22:10 +0900
commitfbb7e9d267095c00d58728901d5e5f4f1b7e7fd0 (patch)
tree973e5901c73e96f8e2cc7c8b6c433b329c69e1cc
parent54a407861ed005e6f24a4012042efea206eaf3f0 (diff)
parent99932ac2bcfc700d0027074f08ec1e99e6cedc0f (diff)
downloadsphinx-git-fbb7e9d267095c00d58728901d5e5f4f1b7e7fd0.tar.gz
Merge branch '1.8' into 2.0
-rw-r--r--CHANGES1
-rw-r--r--sphinx/directives/patches.py9
2 files changed, 7 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index b4eb4a11e..b047332a1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -297,6 +297,7 @@ Bugs fixed
* #6047: autodoc: ``autofunction`` emits a warning for method objects
* #6028: graphviz: Ensure the graphviz filenames are reproducible
* #6068: doctest: ``skipif`` option may remove the code block from documentation
+* #6136: ``:name:`` option for ``math`` directive causes a crash
Testing
--------
diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py
index 3c31571ac..2d8ca636a 100644
--- a/sphinx/directives/patches.py
+++ b/sphinx/directives/patches.py
@@ -126,13 +126,16 @@ class MathDirective(SphinxDirective):
latex = '\n'.join(self.content)
if self.arguments and self.arguments[0]:
latex = self.arguments[0] + '\n\n' + latex
+ label = self.options.get('label', self.options.get('name'))
node = nodes.math_block(latex, latex,
docname=self.env.docname,
- number=self.options.get('name'),
- label=self.options.get('label'),
+ number=None,
+ label=label,
nowrap='nowrap' in self.options)
- ret = [node] # type: List[nodes.Node]
+ self.add_name(node)
set_source_info(self, node)
+
+ ret = [node] # type: List[nodes.Node]
self.add_target(ret)
return ret