diff --git a/README.md b/README.md index 6343c20..7a7df4b 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,10 @@ This is a patched version of [`sphinx.ext.graphviz`](https://github.com/sphinx-d -------------------- -## Added features +## Added features and changes -* TBD +* `2.3.1.post1` + * Updated directive options according to documentation (see: [sphinx-doc/sphinx#6991](https://github.com/sphinx-doc/sphinx/issues/6991#issuecomment-573446371)) ## Cross-References diff --git a/btd/sphinx/graphviz.py b/btd/sphinx/graphviz.py index c16952b..c018dd0 100644 --- a/btd/sphinx/graphviz.py +++ b/btd/sphinx/graphviz.py @@ -151,9 +151,9 @@ def run(self) -> List[Node]: node['options'] = {'docname': self.env.docname} if 'graphviz_dot' in self.options: - node['options']['graphviz_dot'] = self.options['graphviz_dot'] + node['options']['layout'] = self.options['graphviz_dot'] if 'layout' in self.options: - node['options']['graphviz_dot'] = self.options['layout'] + node['options']['layout'] = self.options['layout'] if 'alt' in self.options: node['alt'] = self.options['alt'] if 'align' in self.options: @@ -180,7 +180,8 @@ class GraphvizSimple(SphinxDirective): 'alt': directives.unchanged, 'align': align_spec, 'caption': directives.unchanged, - 'graphviz_dot': directives.unchanged, + 'layout': directives.unchanged, + 'graphviz_dot': directives.unchanged, # an old alias of `layout` option 'name': directives.unchanged, } @@ -190,7 +191,9 @@ def run(self) -> List[Node]: (self.name, self.arguments[0], '\n'.join(self.content)) node['options'] = {'docname': self.env.docname} if 'graphviz_dot' in self.options: - node['options']['graphviz_dot'] = self.options['graphviz_dot'] + node['options']['layout'] = self.options['graphviz_dot'] + if 'layout' in self.options: + node['options']['layout'] = self.options['layout'] if 'alt' in self.options: node['alt'] = self.options['alt'] if 'align' in self.options: @@ -208,7 +211,7 @@ def run(self) -> List[Node]: def render_dot(self: SphinxTranslator, code: str, options: Dict, format: str, prefix: str = 'graphviz') -> Tuple[str, str]: """Render graphviz code into a PNG or PDF output file.""" - graphviz_dot = options.get('graphviz_dot', self.builder.config.graphviz_dot) + graphviz_dot = options.get('layout', self.builder.config.graphviz_dot) hashkey = (code + str(options) + str(graphviz_dot) + str(self.builder.config.graphviz_dot_args)).encode() diff --git a/setup.py b/setup.py index b197e5f..cc6c820 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ projectName = "sphinx.graphviz" projectNameWithPrefix = "btd." + projectName -version = "2.3.1.post1.dev1" +version = "2.3.1.post1" github_url = "https://github.com/buildthedocs/" + projectName rtd_url = "https://" + projectNameWithPrefix.replace(".", "-") + ".readthedocs.io/en/latest/"