Hi.

I'm trying to improve the aafig_ Sphinx extension to use an image node
to output the aafigure_ generated image, so it can take advantage of the
extra image options (like height, width, etc.) and any bug-fixes.
Consistency is a nice advantage too.

The problem is I'm getting an error when doing that.  I'm sorry about the
cross-posting, but I don't know if the error is docutils or Sphinx
related.

What I'm doing is something like::

    def aafig_node_html_visit(self, node):
        # generate the aafigure image
        node.img = nodes.image()
        # copy aafig attributes to the image node
        self.visit_image(node.img)
        raise nodes.SkipNode

def aafig_node_html_depart(self, node):
    self.depart_image(node.img)
    raise nodes.SkipNode

I don't really know if it's ok to skip the node (I just had another error
without the raise nodes.SkipNode).

The error I'm getting is::

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.5/sphinx/cmdline.py", line 172, in main
    app.build(all_files, filenames)
  File "/usr/lib/pymodules/python2.5/sphinx/application.py", line 130, in build
    self.builder.build_update()
  File "/usr/lib/pymodules/python2.5/sphinx/builders/__init__.py", line 265, in 
build_update
    'out of date' % len(to_build))
  File "/usr/lib/pymodules/python2.5/sphinx/builders/__init__.py", line 320, in 
build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/lib/pymodules/python2.5/sphinx/builders/__init__.py", line 359, in 
write
    self.write_doc(docname, doctree)
  File "/usr/lib/pymodules/python2.5/sphinx/builders/html.py", line 343, in 
write_doc
    self.docwriter.write(doctree, destination)
  File "/usr/lib/pymodules/python2.5/docutils/writers/__init__.py", line 76, in 
write
    self.translate()
  File "/usr/lib/pymodules/python2.5/sphinx/writers/html.py", line 37, in 
translate
    self.document.walkabout(visitor)
  File "/usr/lib/pymodules/python2.5/docutils/nodes.py", line 189, in walkabout
    visitor.dispatch_departure(self)
  File "/usr/lib/pymodules/python2.5/docutils/nodes.py", line 1548, in 
dispatch_departure
    return method(node)
  File "/usr/lib/pymodules/python2.5/docutils/writers/html4css1/__init__.py", 
line 712, in depart_document
    assert not self.context, 'len(context) = %s' % len(self.context)
AssertionError: len(context) = 15

I'm doing something wrong? Any ideas how to do that? I can't "emit" an
image node at "parse-time" because I don't know yet what builder will be
used to pick the right output format for aafig.

TIA.

.. _aafig:: http://pypi.python.org/pypi/sphinxcontrib-aafig
.. _aafigure:: https://launchpad.net/aafigure


-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
You look so tired-unhappy,
bring down the government,
they don't, they don't speak for us.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to