# -*- 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 <llucax@gmail.com> \
+ (based on sphinxcontrib.mscgen).
:license: BSD, see LICENSE for details.
"""
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:
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')