graphviz: rename docpath -> docname

This commit is contained in:
Rok Roskar 2018-08-06 16:27:15 +02:00
parent 16734bb11c
commit 615b635635

View File

@ -156,7 +156,7 @@ class Graphviz(SphinxDirective):
node = graphviz() node = graphviz()
node['code'] = dotcode node['code'] = dotcode
node['options'] = { node['options'] = {
'docpath': path.splitext(self.state.document.current_source)[0], 'docname': path.splitext(self.state.document.current_source)[0],
} }
if 'graphviz_dot' in self.options: if 'graphviz_dot' in self.options:
@ -196,7 +196,7 @@ class GraphvizSimple(SphinxDirective):
node['code'] = '%s %s {\n%s\n}\n' % \ node['code'] = '%s %s {\n%s\n}\n' % \
(self.name, self.arguments[0], '\n'.join(self.content)) (self.name, self.arguments[0], '\n'.join(self.content))
node['options'] = { node['options'] = {
'docpath': path.splitext(self.state.document.current_source)[0], 'docname': path.splitext(self.state.document.current_source)[0],
} }
if 'graphviz_dot' in self.options: if 'graphviz_dot' in self.options:
node['options']['graphviz_dot'] = self.options['graphviz_dot'] node['options']['graphviz_dot'] = self.options['graphviz_dot']
@ -241,7 +241,8 @@ def render_dot(self, code, options, format, prefix='graphviz'):
dot_args.extend(self.builder.config.graphviz_dot_args) dot_args.extend(self.builder.config.graphviz_dot_args)
dot_args.extend(['-T' + format, '-o' + outfn]) dot_args.extend(['-T' + format, '-o' + outfn])
cwd = path.dirname(options.get('docpath', self.builder.srcdir)) docname = options.get('docname', 'index')
cwd = path.dirname(path.join(self.builder.srcdir, docname))
if format == 'png': if format == 'png':
dot_args.extend(['-Tcmapx', '-o%s.map' % outfn]) dot_args.extend(['-Tcmapx', '-o%s.map' % outfn])