summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-06-30 09:08:21 +0200
committerGeorg Brandl <georg@python.org>2011-06-30 09:08:21 +0200
commit381b3abead74f0308cadfae35e3ce73a165a546d (patch)
treeafa34594463eb6bd8e0f8721bda861d68f7ca4a7
parent86e7c7d071cd0fcb33b7a5ea22e436df2248575e (diff)
downloadsphinx-381b3abead74f0308cadfae35e3ce73a165a546d.tar.gz
The math extension displaymath directives now support ``name`` in
addition to ``label`` for giving the equation label, for compatibility with Docutils.
-rw-r--r--CHANGES3
-rw-r--r--sphinx/ext/mathbase.py5
2 files changed, 7 insertions, 1 deletions
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]