[sphinx-dev] Re: graphviz extension with latex output missing paragraph break?
On 2010-04-15, Chikei wrote: Hi all, When I use graphviz extension with latex output, the extension output latex like this paragraph1 \includegraphics{graphviz.pdf} paragraph2 which will cause latex think paragraph1 and 2 are same paragraph, apply 188c188 self.body.append('\\includegraphics{%s}' % fname) --- self.body.append('\n\\includegraphics{%s}\n' % fname) to graphviz.py solve this, is this patch OK? or there is some reason to not output these two linebreak? This might be a design issue: in LaTeX, you can simply decide, whether you want the graphic (or a table or a list or ...) to be part of the paragraph: text before \includegraphics{graphviz.pdf} more text appended to the previous paragraph: text before \includegraphics{graphviz.pdf} more text or as a separate paragraph: text before \includegraphics{graphviz.pdf} more text In Docutils, the image, table, list, ... must be written as a separate paragraph:: text before .. image:: graphviz.pdf more text but this might not be what is intended in all cases. Therefore, the Docutils todo.html contains the still unsolved question * Start a new paragraph after lists (as currently) or continue (no blank line in source, no parindent in output)? Overriding: * continue if the `compound paragraph`_ directive is used, or * force a new paragraph with an empty comment. Günter .. _compound paragraph: ../ref/rst/directives.html#compound-paragraph -- You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-...@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
Re: graphviz extension
Hi Charles, I am interested in your graphviz extension, and willing to give a hand to improve it if needed. Before digging into it to fix the image path problem that was mentioned before, I would like to know if you made any change on it and have a more recent version to share ? Thanks, Christophe On 9 sep, 22:45, Charles Duffy [EMAIL PROTECTED] wrote: Per subject. This is my first attempt at a Sphinx extension, so I'm certain there's plenty of room for improvement; see attached. Usage is as follows: .. graphviz:: strict digraph { foo - bar - baz; foo - qux; } This in rendered into PNG (for use with HTML), PDF (for use with LaTeX) and postscript. Please let me know if there are improvements I could make which would allow this extension to be merged into Sphinx proper. Thanks! graphviz.py 3KAfficherTélécharger --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: graphviz extension
Christophe de Vienne wrote: Hi Charles, I am interested in your graphviz extension, and willing to give a hand to improve it if needed. Before digging into it to fix the image path problem that was mentioned before, I would like to know if you made any change on it and have a more recent version to share ? Christophe, Thank you for your interest! The most recent version is datestamped September 12, and the only difference from the version posted appears to be removing app.builder.imgpath from the candidate filenames; I haven't had the opportunity to do a more complete refactoring to properly resolve the issue. As such, any assistance you might offer would be gratefully accepted. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com 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 -~--~~~~--~~--~--~--- --- graphviz.py.old 2008-10-21 12:40:36.0 -0500 +++ graphviz.py 2008-09-12 08:15:46.0 -0500 @@ -50,14 +50,14 @@ graphviz_process.wait() relfn = '_images/graphviz/%s' % (filename,) newnode = nodes.image() -newnode['candidates'] = dict( [ (format_mime, '%s.%s' % (relfn, format_ext)) for (format_mime, format_ext) in _output_formats.iteritems() ] ) +newnode['candidates'] = dict( [ (format_mime, '%s/%s.%s' % (app.builder.imgpath, relfn, format_ext)) for (format_mime, format_ext) in _output_formats.iteritems() ] ) # build PDF output from the previously generated postscript Popen([ getattr(app.builder.config, 'graphviz_ps2pdf', 'ps2pdf'), '%s.ps' % (outfn,), '%s.pdf' % (outfn,) ]).wait() -newnode['candidates']['application/pdf'] = '%s.pdf' % (outfn,) +newnode['candidates']['application/pdf'] = '%s/%s.pdf' % (app.builder.imgpath, outfn,) # and that's all, folks! node.replace_self(newnode) except Exception, err:
Re: graphviz extension
Charles Duffy schrieb: I appreciate the report... that said, I'm a little unclear on what the Right Way to fix this is. sphinx.ext.pngmath appears to reference a self.builder.imgpath in render_math, but app.builder.imgpath doesn't appear to exist when process_graphviz_nodes is called from the doctree- resolved hook: WARNING: /home/cduffy/fvte/doc/concepts.rst:53: (ERROR/3) Exception occured evaluating graphviz expression: AttributeError: 'StandaloneHTMLBuilder' object has no attribute 'imgpath' WARNING: /home/cduffy/fvte/doc/index.rst:: (ERROR/3) Exception occured evaluating graphviz expression: AttributeError: 'LaTeXBuilder' object has no attribute 'imgpath' Given such, I'm rather curious about why imgpath is available for pngmath's use. pngmath renders the PNG when visiting the node in the HTML translator, while you already transform away the nodes directly before calling the translator. Perhaps this is also what the graphviz extension should do. BTW, I just saw that matplotlib has a custom extension that creates inheritance graphs with graphviz: http://groups.google.com/group/sphinx-dev/browse_thread/thread/e1f816aa58743e37/64cb54e5490ea2af?lnk=gstq=inheritance#64cb54e5490ea2af Perhaps the code calling graphviz can be consolidated, so that this extension can make use of the graphviz extension once it's in sphinx.ext. cheers, Georg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sphinx-dev group. To post to this group, send email to sphinx-dev@googlegroups.com 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 -~--~~~~--~~--~--~---