Make debug print_tree
more comprehensive.
This commit is contained in:
parent
9231013ea9
commit
18ceb6bca5
@ -232,15 +232,28 @@ def main(src_top, dest_top):
|
||||
logging.info("Updated all in {:.2f}s".format(time.time() - t0))
|
||||
|
||||
|
||||
def print_tree(tree, indentation=0):
|
||||
def print_tree(tree, indentation=0, headline=None):
|
||||
# if headline and headline.id != INDEX_ID:
|
||||
# return
|
||||
return
|
||||
for element in tree:
|
||||
print(" " * indentation + "- " + str(type(element)))
|
||||
if "children" in dir(element):
|
||||
if len(element.children) > 0:
|
||||
print_tree(element.children, indentation + 1)
|
||||
print_element(element.children, indentation + 1, headline)
|
||||
print()
|
||||
|
||||
elif "content" in dir(element):
|
||||
for content in element.content:
|
||||
print_element(content, indentation + 1, headline)
|
||||
|
||||
def print_element(element, indentation, headline):
|
||||
if isinstance(element, org_rw.Link):
|
||||
print(" " * indentation, "Link:", element.get_raw())
|
||||
elif isinstance(element, str):
|
||||
print(" " * indentation, "{" + element + "}", type(element))
|
||||
else:
|
||||
print_tree(element, indentation, headline)
|
||||
|
||||
|
||||
def render_property_drawer(element, acc):
|
||||
pass
|
||||
@ -334,7 +347,7 @@ def render(headline, doc, headlineLevel):
|
||||
except:
|
||||
logging.error("Error generating DOM for {}".format(doc.path))
|
||||
raise
|
||||
print_tree(dom)
|
||||
print_tree(dom, indentation=2, headline=headline)
|
||||
|
||||
content = []
|
||||
render_tree(dom, content)
|
||||
|
Loading…
Reference in New Issue
Block a user