summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2011-06-29 14:53:15 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2011-06-29 14:53:15 +0000
commit6990ec17e04c6948a744cb4e35d6e78f5ccfff4c (patch)
treeb9d17917ac33f7b2866704a2d4b353ac2d219ef1 /docutils
parentdd6430a706a2a70944a88ac931560d04448cb14a (diff)
downloaddocutils-6990ec17e04c6948a744cb4e35d6e78f5ccfff4c.tar.gz
Wrap MathML in <div> or <span>
Allows setting id and name with starttag() method. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7060 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/writers/html4css1/__init__.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/docutils/writers/html4css1/__init__.py b/docutils/writers/html4css1/__init__.py
index 48cf50844..54376f5a8 100644
--- a/docutils/writers/html4css1/__init__.py
+++ b/docutils/writers/html4css1/__init__.py
@@ -1135,15 +1135,15 @@ class HTMLTranslator(nodes.NodeVisitor):
# If the method is called from visit_math_block(), math_env != ''.
#
# HTML container
- tags = {# math_mode: (inline, block, class-arguments)
- 'mathml': (None, None, None),
- 'html': ('span', 'div', 'formula'),
- 'mathjax': ('span', 'div', 'math'),
- 'latex': ('tt', 'pre', 'math'),
+ tags = {# math_output: (block, inline, class-arguments)
+ 'mathml': ('div', 'span', ''),
+ 'html': ('div', 'span', 'formula'),
+ 'mathjax': ('div', 'span', 'math'),
+ 'latex': ('pre', 'tt', 'math'),
}
- tag = tags[self.math_output][math_env != '']
+ tag = tags[self.math_output][math_env == '']
clsarg = tags[self.math_output][2]
- # LaTeX container
+ # LaTeX container
wrappers = {# math_mode: (inline, block)
'mathml': (None, None),
'html': ('$%s$', u'\\begin{%s}\n%s\n\\end{%s}'),
@@ -1182,14 +1182,12 @@ class HTMLTranslator(nodes.NodeVisitor):
self.body.append('\n</pre>\n')
self.depart_system_message(err_node)
raise nodes.SkipNode
- # now append
- if tag:
- self.body.append(self.starttag(node, tag, CLASS=clsarg))
+ # append to document body
+ self.body.append(self.starttag(node, tag, CLASS=clsarg))
self.body.append(math_code)
if math_env:
self.body.append('\n')
- if tag:
- self.body.append('</%s>\n' % tag)
+ self.body.append('</%s>\n' % tag)
# Content already processed:
raise nodes.SkipNode