Skip to content

Commit 785c242

Browse files
committed
Fixed options according to official documentation.
See sphinx-doc/sphinx#6991 (comment)
1 parent 5566eae commit 785c242

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ This is a patched version of [`sphinx.ext.graphviz`](https://github.com/sphinx-d
2323
2424
--------------------
2525

26-
## Added features
26+
## Added features and changes
2727

28-
* TBD
28+
* `2.3.1.post1`
29+
* Updated directive options according to documentation (see: [sphinx-doc/sphinx#6991](https://github.com/sphinx-doc/sphinx/issues/6991#issuecomment-573446371))
2930

3031
## Cross-References
3132

btd/sphinx/graphviz.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ def run(self) -> List[Node]:
151151
node['options'] = {'docname': self.env.docname}
152152

153153
if 'graphviz_dot' in self.options:
154-
node['options']['graphviz_dot'] = self.options['graphviz_dot']
154+
node['options']['layout'] = self.options['graphviz_dot']
155155
if 'layout' in self.options:
156-
node['options']['graphviz_dot'] = self.options['layout']
156+
node['options']['layout'] = self.options['layout']
157157
if 'alt' in self.options:
158158
node['alt'] = self.options['alt']
159159
if 'align' in self.options:
@@ -180,7 +180,8 @@ class GraphvizSimple(SphinxDirective):
180180
'alt': directives.unchanged,
181181
'align': align_spec,
182182
'caption': directives.unchanged,
183-
'graphviz_dot': directives.unchanged,
183+
'layout': directives.unchanged,
184+
'graphviz_dot': directives.unchanged, # an old alias of `layout` option
184185
'name': directives.unchanged,
185186
}
186187

@@ -190,7 +191,9 @@ def run(self) -> List[Node]:
190191
(self.name, self.arguments[0], '\n'.join(self.content))
191192
node['options'] = {'docname': self.env.docname}
192193
if 'graphviz_dot' in self.options:
193-
node['options']['graphviz_dot'] = self.options['graphviz_dot']
194+
node['options']['layout'] = self.options['graphviz_dot']
195+
if 'layout' in self.options:
196+
node['options']['layout'] = self.options['layout']
194197
if 'alt' in self.options:
195198
node['alt'] = self.options['alt']
196199
if 'align' in self.options:
@@ -208,7 +211,7 @@ def run(self) -> List[Node]:
208211
def render_dot(self: SphinxTranslator, code: str, options: Dict,
209212
format: str, prefix: str = 'graphviz') -> Tuple[str, str]:
210213
"""Render graphviz code into a PNG or PDF output file."""
211-
graphviz_dot = options.get('graphviz_dot', self.builder.config.graphviz_dot)
214+
graphviz_dot = options.get('layout', self.builder.config.graphviz_dot)
212215
hashkey = (code + str(options) + str(graphviz_dot) +
213216
str(self.builder.config.graphviz_dot_args)).encode()
214217

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
projectName = "sphinx.graphviz"
5151
projectNameWithPrefix = "btd." + projectName
52-
version = "2.3.1.post1.dev1"
52+
version = "2.3.1.post1"
5353

5454
github_url = "https://github.com/buildthedocs/" + projectName
5555
rtd_url = "https://" + projectNameWithPrefix.replace(".", "-") + ".readthedocs.io/en/latest/"

0 commit comments

Comments
 (0)