From bd1637eb889cd2d92fc7d814cf95e8abfbae7fce Mon Sep 17 00:00:00 2001 From: Milka64 Date: Mon, 11 Dec 2023 07:13:33 +0100 Subject: [PATCH] fix svg build --- sphinx_d2lang/d2lang.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sphinx_d2lang/d2lang.py b/sphinx_d2lang/d2lang.py index f2c11b7..78f1dae 100644 --- a/sphinx_d2lang/d2lang.py +++ b/sphinx_d2lang/d2lang.py @@ -16,8 +16,9 @@ class D2langDirective(Directive): srcdir = self.state.document.settings.env.srcdir diag_source = self.content with tempfile.NamedTemporaryFile() as fp: - for line in self.content: + for line in self.content.splitlines(): fp.write(bytes(line,'utf-8')) + fp.seek(0) cmd_line = '%s %s %s' % (d2_bin, fp.name, srcdir + "/test.svg") args = shlex.split(cmd_line) subprocess.run(args)