Fix typo on intermediate dot file name.

This commit is contained in:
Sergio Martínez Portela 2023-06-13 00:00:35 +02:00
parent fa789984f4
commit 960a3693d3
2 changed files with 4 additions and 6 deletions

View File

@ -1,12 +1,10 @@
import requests
import sys
import subprocess import subprocess
import ops_cache import ops_cache
import copy import copy
import tempfile import tempfile
import os
# TODO: Properly render outgouing links # TODO: Properly render outgouing links
@ops_cache.cache @ops_cache.cache
def gen(headline_id, graph): def gen(headline_id, graph):
reference_node = headline_id reference_node = headline_id
@ -117,9 +115,9 @@ def gen(headline_id, graph):
print("_" + k.replace("-", "_") + "->" + t, file=f) print("_" + k.replace("-", "_") + "->" + t, file=f)
f.write('}\n') f.write('}\n')
f.close() f.flush()
with tempfile.NamedTemporaryFile(suffix='.svg') as fsvg: with tempfile.NamedTemporaryFile(suffix='.svg') as fsvg:
subprocess.call("fdp graph.dot -Tsvg -o '{}'".format(fsvg.name), shell=True) subprocess.call(['fdp', f.name, '-Tsvg', '-o', fsvg.name])
fsvg.seek(0) fsvg.seek(0)
return fsvg.read().decode() return fsvg.read().decode()

View File

@ -725,7 +725,7 @@ def render(headline, doc, graph, headlineLevel):
content = [] content = []
render_tree(dom, content, headline, graph) render_tree(dom, content, headline, graph)
if headline.id: if headline.id and headlineLevel == 0:
render_connections(headline.id, content, graph) render_connections(headline.id, content, graph)
for child in headline.children: for child in headline.children: