From 65c15020236aa3e3bf24c97be1a925286c7a5dc6 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sat, 6 Jun 2009 15:28:57 -0300 Subject: [PATCH] =?utf8?q?Actualizar=20extensi=C3=B3n=20aafig?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ext/aafig.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ext/aafig.py b/ext/aafig.py index 7850613..a168b2a 100644 --- a/ext/aafig.py +++ b/ext/aafig.py @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- """ - sphinxcontrib.aafigure - ~~~~~~~~~~~~~~~~~~~~~~ + sphinxcontrib.aafig + ~~~~~~~~~~~~~~~~~~~ - Allow mscgen-formatted :abbr:`MSC (Message Sequence Chart)` graphs to be - included in Sphinx-generated documents inline. + Allow embeded ASCII art to be rendered as nice looking images + using the aafigure reStructuredText extension. See the README file for details. - :copyright: Copyright 2009 by Leandro Lucarella (based on \ - sphinx.ext.graphviz). + :copyright: Copyright 2009 by Leandro Lucarella \ + (based on sphinxcontrib.mscgen). :license: BSD, see LICENSE for details. """ @@ -88,6 +88,11 @@ def render_aafigure(self, text, options, prefix): ensuredir(path.dirname(outfn)) + # merge default options + for (k, v) in self.builder.config.aafig_default_options.items(): + if k not in options: + options[k] = v + try: aafigure.render(text, outfn, options) except aafigure.UnsupportedFormatError, e: @@ -136,8 +141,10 @@ def render_latex(self, node, text, options, prefix=DEFAULT_PREFIX): def latex_visit(self, node): render_latex(self, node, node['text'], node['options']) + def setup(app): app.add_node(aafig, html=(html_visit, None), latex=(latex_visit, None)) app.add_directive('aafig', Aafig) app.add_config_value('aafig_format', dict(html='svg', latex='pdf'), 'html') + app.add_config_value('aafig_default_options', dict(), 'html') -- 2.43.0