From dd6430a706a2a70944a88ac931560d04448cb14a Mon Sep 17 00:00:00 2001 From: milde Date: Mon, 27 Jun 2011 20:54:13 +0000 Subject: [PATCH] Fix math import. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7059 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/math/__init__.py | 7 +++++-- docutils/writers/html4css1/__init__.py | 8 ++++---- docutils/writers/latex2e/__init__.py | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/docutils/math/__init__.py b/docutils/math/__init__.py index 58857778f..096853dc0 100644 --- a/docutils/math/__init__.py +++ b/docutils/math/__init__.py @@ -1,12 +1,12 @@ # :Id: $Id$ # :Author: Guenter Milde. # :License: Released under the terms of the `2-Clause BSD license`_, in short: -# +# # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. # This file is offered as-is, without any warranty. -# +# # .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause """ @@ -19,6 +19,9 @@ It contains various modules for conversion between different math formats :latex2mathml: LaTeX math -> presentational MathML :unimathsymbols2tex: Unicode symbol to LaTeX math translation table """ +__all__ = ['math2html', + 'latex2mathml', + 'unimathsymbols2tex'] # helpers for Docutils math support # ================================= diff --git a/docutils/writers/html4css1/__init__.py b/docutils/writers/html4css1/__init__.py index e2ea791e0..48cf50844 100644 --- a/docutils/writers/html4css1/__init__.py +++ b/docutils/writers/html4css1/__init__.py @@ -24,8 +24,9 @@ try: except ImportError: Image = None import docutils -from docutils import frontend, nodes, utils, writers, languages, io, math +from docutils import frontend, nodes, utils, writers, languages, io from docutils.transforms import writer_aux +from docutils.math import unimathsymbols2tex, pick_math_environment from docutils.math.latex2mathml import parse_latex_math from docutils.math.math2html import math2html @@ -1151,8 +1152,7 @@ class HTMLTranslator(nodes.NodeVisitor): } wrapper = wrappers[self.math_output][math_env != ''] # get and wrap content - math_code = node.astext().translate( - math.unimathsymbols2tex.uni2tex_table) + math_code = node.astext().translate(unimathsymbols2tex.uni2tex_table) if wrapper and math_env: math_code = wrapper % (math_env, math_code, math_env) elif wrapper: @@ -1197,7 +1197,7 @@ class HTMLTranslator(nodes.NodeVisitor): pass # never reached def visit_math_block(self, node): - math_env = math.pick_math_environment(node.astext()) + math_env = pick_math_environment(node.astext()) self.visit_math(node, math_env=math_env) def depart_math_block(self, node): diff --git a/docutils/writers/latex2e/__init__.py b/docutils/writers/latex2e/__init__.py index c31f64601..8de5447fd 100644 --- a/docutils/writers/latex2e/__init__.py +++ b/docutils/writers/latex2e/__init__.py @@ -18,8 +18,9 @@ import time import re import string import urllib -from docutils import frontend, nodes, languages, writers, utils, io, math +from docutils import frontend, nodes, languages, writers, utils, io from docutils.transforms import writer_aux +from docutils.math import unimathsymbols2tex, pick_math_environment # compatibility module for Python 2.3 if not hasattr(string, 'Template'): @@ -2429,8 +2430,7 @@ class LaTeXTranslator(nodes.NodeVisitor): if node['classes']: self.visit_inline(node) self.requirements['amsmath'] = r'\usepackage{amsmath}' - math_code = node.astext().translate( - math.unimathsymbols2tex.uni2tex_table) + math_code = node.astext().translate(unimathsymbols2tex.uni2tex_table) if math_env == '$': wrapper = u'$%s$' else: -- 2.11.4.GIT