Issue #245 resolved

pngmath generates invalid html - fix proposed

Anonymous created an issue

When pngmath inserts an image into an html page, it closes tags out of order like this: <div><p>...</div></p> You can verify the bug by submitting the resulting html file to . The fix is easy. I am uploading a patch and a test case.

I am using sphinx 0.5.2

Comments (4)

  1. Anonymous

    .. Here is a testcase. Compile this from a default sphinx configuration (including pngmath) and upload it to the W3C validator to see the error

    .. pngmath-test documentation master file, created by sphinx-quickstart on Fri Aug 28 17:30:16 2009. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive.

    Welcome to pngmath-test's documentation!


    .. toctree:: :maxdepth: 2


    This is valid math

    .. math::

    f(x) = x^2

    This is invalid math

    .. math::

    f(x) = }

    Indices and tables

    • :ref:`genindex`
    • :ref:`modindex`
    • :ref:`search`
  2. Anonymous

    Here is the patch to apply to

    --- 2009-08-28 17:32:46.000000000 -0600 +++ /usr/share/python-support/python-sphinx/sphinx/ext/ 2009-08-28 17:33:07.000000000 -0600 @@ -226,9 +226,10 @@ self.body.append('<span class="math">%s</span>' % self.encode(node['latex']).strip()) else: - self.body.append('<img src="%s" alt="%s" />\n</div>' % + self.body.append('<img src="%s" alt="%s" />\n' % (fname, self.encode(node['latex']).strip())) self.body.append('</p>') + self.body.append('</div>') raise nodes.SkipNode

  3. Log in to comment