summaryrefslogtreecommitdiff
path: root/sphinx/directives/patches.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-04 23:32:19 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-06 01:46:45 +0900
commit346d33bf540213b0d1ac0f58b8d29fbb1796db3d (patch)
treec65ca853929a79503676b4e4f712912667dce1e7 /sphinx/directives/patches.py
parentbe971c6d385b42524e0660f788abf6399877bc30 (diff)
downloadsphinx-git-346d33bf540213b0d1ac0f58b8d29fbb1796db3d.tar.gz
Fix #6136: ``:name:`` option for ``math`` directive causes a crash
Diffstat (limited to 'sphinx/directives/patches.py')
-rw-r--r--sphinx/directives/patches.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py
index 9b4ce6b25..42288d9b0 100644
--- a/sphinx/directives/patches.py
+++ b/sphinx/directives/patches.py
@@ -123,13 +123,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.state.document.settings.env.docname,
- number=self.options.get('name'),
- label=self.options.get('label'),
+ number=None,
+ label=label,
nowrap='nowrap' in self.options)
- ret = [node]
+ self.add_name(node)
set_source_info(self, node)
+
+ ret = [node]
self.add_target(ret)
return ret