From d6c8b9f3db3852c4609667c45eabf4bc1c7ef21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Mon, 19 Jun 2023 00:07:40 +0200 Subject: [PATCH] Fix links originating from top-level of graph center. --- scripts/gen_centered_graph.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/gen_centered_graph.py b/scripts/gen_centered_graph.py index 40840b9..6806e1a 100644 --- a/scripts/gen_centered_graph.py +++ b/scripts/gen_centered_graph.py @@ -9,15 +9,20 @@ import os def gen(headline_id, graph): reference_node = headline_id + linked_from_internal = set() g = copy.deepcopy(graph) centered_graph = { reference_node: g[reference_node] } + for l in g[reference_node]['links']: + lt = l['target'] + if lt.startswith("id:"): + lt = lt[3:] + linked_from_internal.add(lt) del g[reference_node] new_nodes = True in_emacs_tree = { reference_node: set(), } - linked_from_internal = set() while new_nodes: new_nodes = False