The math extension displaymath directives now support `name` in

addition to ``label`` for giving the equation label, for compatibility
with Docutils.
This commit is contained in:
Georg Brandl 2011-06-30 09:08:21 +02:00
parent 485e1e0d37
commit 66c2bc7b9c
2 changed files with 7 additions and 1 deletions

View File

@ -91,6 +91,9 @@ Features added
- #367: Added automatic exclusion of hidden members in inheritance - #367: Added automatic exclusion of hidden members in inheritance
diagrams, and an option to selectively enable it. diagrams, and an option to selectively enable it.
- Added :confval:`pngmath_add_tooltips`. - 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: * New locales:

View File

@ -56,6 +56,7 @@ class MathDirective(Directive):
final_argument_whitespace = True final_argument_whitespace = True
option_spec = { option_spec = {
'label': directives.unchanged, 'label': directives.unchanged,
'name': directives.unchanged,
'nowrap': directives.flag, 'nowrap': directives.flag,
} }
@ -65,6 +66,8 @@ class MathDirective(Directive):
latex = self.arguments[0] + '\n\n' + latex latex = self.arguments[0] + '\n\n' + latex
node = displaymath() node = displaymath()
node['latex'] = latex node['latex'] = latex
node['label'] = self.options.get('name', None)
if node['label'] is None:
node['label'] = self.options.get('label', None) node['label'] = self.options.get('label', None)
node['nowrap'] = 'nowrap' in self.options node['nowrap'] = 'nowrap' in self.options
node['docname'] = self.state.document.settings.env.docname node['docname'] = self.state.document.settings.env.docname