This commit is contained in:
Georg Brandl 2010-08-23 16:24:13 +00:00
commit e2d180f636
2 changed files with 6 additions and 3 deletions

View File

@ -26,6 +26,7 @@ from docutils import nodes
from sphinx.errors import SphinxError
from sphinx.util.png import read_png_depth, write_png_depth
from sphinx.util.osutil import ensuredir, ENOENT
from sphinx.util.pycompat import b
from sphinx.ext.mathbase import setup_math as mathbase_setup, wrap_displaymath
class MathExtError(SphinxError):
@ -58,7 +59,7 @@ DOC_BODY_PREVIEW = r'''
\end{document}
'''
depth_re = re.compile(r'\[\d+ depth=(-?\d+)\]')
depth_re = re.compile(b(r'\[\d+ depth=(-?\d+)\]'))
def render_math(self, math):
"""Render the LaTeX math expression *math* using latex and dvipng.

View File

@ -12,12 +12,14 @@
import struct
import binascii
from sphinx.util.pycompat import b
LEN_IEND = 12
LEN_DEPTH = 22
DEPTH_CHUNK_LEN = struct.pack('!i', 10)
DEPTH_CHUNK_START = 'tEXtDepth\x00'
IEND_CHUNK = '\x00\x00\x00\x00IEND\xAE\x42\x60\x82'
DEPTH_CHUNK_START = b('tEXtDepth\x00')
IEND_CHUNK = b('\x00\x00\x00\x00IEND\xAE\x42\x60\x82')
def read_png_depth(filename):