Indicate name of graph relations.

Most changes taken from: http://bl.ocks.org/fancellu/2c782394602a93921faff74e594d1bb1
This commit is contained in:
Sergio Martínez Portela 2022-05-16 23:28:43 +02:00
parent 819948e969
commit 386b3a1855
2 changed files with 92 additions and 21 deletions

View file

@ -135,7 +135,7 @@ def main(src_top, dest_top):
if isinstance(headline.parent, org_rw.Headline):
links.append({
"target": headline.parent.id,
"relation": "contained-in"
"relation": "in"
})
graph[headline.id] = {
"title": headline.title.strip(),
@ -161,6 +161,7 @@ def main(src_top, dest_top):
def print_tree(tree, indentation=0):
return
for element in tree:
print(" " * indentation + "- " + str(type(element)))
if "children" in dir(element):
@ -226,8 +227,8 @@ def render_text_tokens(tokens, acc):
html.escape(link_target),
html.escape(description),
))
else:
raise NotImplementedError('TextToken: {}'.format(chunk))
# else:
# raise NotImplementedError('TextToken: {}'.format(chunk))
def render_tag(element, acc):
@ -247,11 +248,12 @@ def render_tree(tree, acc):
render_tag(element, acc)
def render(headline, doc):
if headline.id != "ea48ec1d-f9d4-4fb7-b39a-faa7b6e2ba95":
return ""
print("\n===========")
dom = headline.as_dom()
def render(headline, doc, headlineLevel):
try:
dom = headline.as_dom()
except:
logging.error("Error generating DOM for {}".format(doc.path))
raise
print_tree(dom)
content = []