chore(org-rw): Update headline title handling.

This commit is contained in:
Sergio Martínez Portela 2022-08-28 19:37:53 +02:00
parent b610d356e8
commit 4a64a9c732

View File

@ -124,7 +124,8 @@ def regen_all(src_top, dest_top, docs=None):
with open(endpath, "wt") as f: with open(endpath, "wt") as f:
doc_to_headline_remapping['id:' + doc.id] = 'id:' + main_headline.id doc_to_headline_remapping['id:' + doc.id] = 'id:' + main_headline.id
f.write(as_document(render(main_headline, doc, headlineLevel=0), main_headline.title)) f.write(as_document(render(main_headline, doc, headlineLevel=0),
org_rw.token_list_to_plaintext(main_headline.title.contents)))
files_generated += 1 files_generated += 1
elif doc.id is not None: elif doc.id is not None:
logging.error("Cannot render document from id: {}. {} headlines {} related".format( logging.error("Cannot render document from id: {}. {} headlines {} related".format(
@ -170,19 +171,21 @@ def regen_all(src_top, dest_top, docs=None):
"relation": "in" "relation": "in"
}) })
graph[headline.id] = { graph[headline.id] = {
"title": org_rw.token_list_to_plaintext(headline.title.contents).strip(), "title": org_rw.org_rw.token_list_to_plaintext(headline.title.contents).strip(),
"links": links, "links": links,
"depth": headline.depth, "depth": headline.depth,
} }
with open(endpath, "wt") as f: with open(endpath, "wt") as f:
f.write(as_document(render(headline, doc, headlineLevel=0), headline.title)) f.write(as_document(render(headline, doc, headlineLevel=0),
org_rw.token_list_to_plaintext(headline.title.contents)))
files_generated += 1 files_generated += 1
if headline.id == INDEX_ID: if headline.id == INDEX_ID:
index_endpath = os.path.join(dest_top, "index.html") index_endpath = os.path.join(dest_top, "index.html")
with open(index_endpath, "wt") as f: with open(index_endpath, "wt") as f:
f.write(as_document(render(headline, doc, headlineLevel=0), headline.title)) f.write(as_document(render(headline, doc, headlineLevel=0),
org_rw.token_list_to_plaintext(headline.title.contents)))
files_generated += 1 files_generated += 1
# Update graph, replace document ids with headline ids # Update graph, replace document ids with headline ids