diff --git a/scripts/gen_centered_graph.py b/scripts/gen_centered_graph.py index fce246e..f39b755 100644 --- a/scripts/gen_centered_graph.py +++ b/scripts/gen_centered_graph.py @@ -1,12 +1,10 @@ -import requests -import sys import subprocess import ops_cache import copy import tempfile +import os # TODO: Properly render outgouing links - @ops_cache.cache def gen(headline_id, graph): reference_node = headline_id @@ -117,9 +115,9 @@ def gen(headline_id, graph): print("_" + k.replace("-", "_") + "->" + t, file=f) f.write('}\n') - f.close() + f.flush() 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) return fsvg.read().decode() diff --git a/scripts/generate.py b/scripts/generate.py index c6ecc3d..cff7b37 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -725,7 +725,7 @@ def render(headline, doc, graph, headlineLevel): content = [] render_tree(dom, content, headline, graph) - if headline.id: + if headline.id and headlineLevel == 0: render_connections(headline.id, content, graph) for child in headline.children: