From 381b3abead74f0308cadfae35e3ce73a165a546d Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 30 Jun 2011 09:08:21 +0200 Subject: The math extension displaymath directives now support ``name`` in addition to ``label`` for giving the equation label, for compatibility with Docutils. --- CHANGES | 3 +++ sphinx/ext/mathbase.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 501c5912..47ac85a6 100644 --- a/CHANGES +++ b/CHANGES @@ -91,6 +91,9 @@ Features added - #367: Added automatic exclusion of hidden members in inheritance diagrams, and an option to selectively enable it. - Added :confval:`pngmath_add_tooltips`. + - The math extension displaymath directives now support ``name`` in + addition to ``label`` for giving the equation label, for compatibility + with Docutils. * New locales: diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py index b5473449..1a2ca6af 100644 --- a/sphinx/ext/mathbase.py +++ b/sphinx/ext/mathbase.py @@ -56,6 +56,7 @@ class MathDirective(Directive): final_argument_whitespace = True option_spec = { 'label': directives.unchanged, + 'name': directives.unchanged, 'nowrap': directives.flag, } @@ -65,7 +66,9 @@ class MathDirective(Directive): latex = self.arguments[0] + '\n\n' + latex node = displaymath() node['latex'] = latex - node['label'] = self.options.get('label', None) + node['label'] = self.options.get('name', None) + if node['label'] is None: + node['label'] = self.options.get('label', None) node['nowrap'] = 'nowrap' in self.options node['docname'] = self.state.document.settings.env.docname ret = [node] -- cgit v1.2.1