Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-11-30 17:51:16 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-11-30 18:50:20 +0300
commitd4a199a91de1be4e59b3c77bb566bcc5d9233542 (patch)
tree925c301f6a2beee13a533be94e69095706a6e5ca /sphinx/ext/graphviz.py
parent6f8b3d88d1cd51eb58f078a95a6fa95870fb2be5 (diff)
Fix annotations for extensions
Diffstat (limited to 'sphinx/ext/graphviz.py')
-rw-r--r--sphinx/ext/graphviz.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py
index 0dad19f98..ea10f9173 100644
--- a/sphinx/ext/graphviz.py
+++ b/sphinx/ext/graphviz.py
@@ -169,12 +169,13 @@ class Graphviz(SphinxDirective):
if 'align' in self.options:
node['align'] = self.options['align']
- caption = self.options.get('caption')
- if caption:
- node = figure_wrapper(self, node, caption)
-
- self.add_name(node)
- return [node]
+ if 'caption' not in self.options:
+ self.add_name(node)
+ return [node]
+ else:
+ figure = figure_wrapper(self, node, self.options['caption'])
+ self.add_name(figure)
+ return [figure]
class GraphvizSimple(SphinxDirective):
@@ -208,12 +209,13 @@ class GraphvizSimple(SphinxDirective):
if 'align' in self.options:
node['align'] = self.options['align']
- caption = self.options.get('caption')
- if caption:
- node = figure_wrapper(self, node, caption)
-
- self.add_name(node)
- return [node]
+ if 'caption' not in self.options:
+ self.add_name(node)
+ return [node]
+ else:
+ figure = figure_wrapper(self, node, self.options['caption'])
+ self.add_name(figure)
+ return [figure]
def render_dot(self, code, options, format, prefix='graphviz'):