diff --git a/CHANGES b/CHANGES index a95350b0b..59e44e404 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Release 0.6.3 (in development) ============================== +* #253: Ignore graphviz directives without content instead of + raising an unhandled exception. + * #241: Fix a crash building LaTeX output for documents that contain a todolist directive. diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index a5a7c92ac..1b6a03eef 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -50,8 +50,13 @@ class Graphviz(Directive): option_spec = {} def run(self): + dotcode = '\n'.join(self.content) + if not dotcode.strip(): + return [self.state_machine.reporter.warning( + 'Ignoring "graphviz" directive without content.', + line=self.lineno)] node = graphviz() - node['code'] = '\n'.join(self.content) + node['code'] = dotcode node['options'] = [] return [node]