update tmp path
This commit is contained in:
parent
2e0d474d90
commit
c067d5fa43
3 changed files with 9 additions and 4 deletions
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||
|
||||
[project]
|
||||
name = "sphinxcontrib-d2lang"
|
||||
version = "0.0.1"
|
||||
version = "0.0.3"
|
||||
authors = [
|
||||
{ name="Milka64", email="michael.ricart@0w.tf" },
|
||||
]
|
||||
|
|
2
setup.py
2
setup.py
|
@ -14,7 +14,7 @@ with open('README.md', 'r', encoding='utf8') as file:
|
|||
|
||||
setup(
|
||||
name='sphinxcontrib-d2lang',
|
||||
version='0.0.1',
|
||||
version='0.0.3',
|
||||
author='Milka64',
|
||||
author_email='michael.ricart@0w.tf',
|
||||
url='https://git.0w.tf/Milka64/sphinx-d2lang/',
|
||||
|
|
|
@ -42,7 +42,7 @@ class D2langDirective(SphinxDirective):
|
|||
else:
|
||||
raise
|
||||
else:
|
||||
with tempfile.NamedTemporaryFile() as fp:
|
||||
with tempfile.NamedTemporaryFile(dir="./") as fp:
|
||||
for line in self.content.data:
|
||||
fp.write(bytes(line,'utf-8'))
|
||||
fp.write(bytes('\n','utf-8'))
|
||||
|
@ -53,7 +53,12 @@ class D2langDirective(SphinxDirective):
|
|||
|
||||
def build_svg(diag_src, out_dir, filename, layout):
|
||||
d2_bin = which('d2')
|
||||
cmd_line = '%s -l %s %s %s' % (d2_bin, layout, diag_src, out_dir + "/" + filename)
|
||||
cmd_line = '{bin} -l {layout} {src} {out}'.format(
|
||||
bin=d2_bin,
|
||||
layout=layout,
|
||||
src=diag_src,
|
||||
out=out_dir + "/" + filename
|
||||
)
|
||||
args = shlex.split(cmd_line)
|
||||
subprocess.run(args)
|
||||
return True
|
||||
|
|
Loading…
Add table
Reference in a new issue