Generate file-level nodes if OrgDoc has ID.
This is for compatibility with Org-Roam v2.
This commit is contained in:
parent
2c6d54d9ed
commit
1fd1827821
@ -83,6 +83,24 @@ def main(src_top, dest_top):
|
|||||||
# print("Skip:", relpath)
|
# print("Skip:", relpath)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if doc.id is not None:
|
||||||
|
topHeadlines = doc.getTopHeadlines()
|
||||||
|
|
||||||
|
if ((len(topHeadlines) == 1 and related is None)
|
||||||
|
or (len(topHeadlines) == 2 and related is not None)):
|
||||||
|
endpath = os.path.join(dest_top, doc.id + ".node.html")
|
||||||
|
|
||||||
|
main_headline = [h for h in topHeadlines if h != related][0]
|
||||||
|
with open(endpath, "wt") as f:
|
||||||
|
f.write(as_document(render(main_headline, doc)))
|
||||||
|
files_generated += 1
|
||||||
|
else:
|
||||||
|
logging.error("Cannot render document from id: {}. {} headlines {} related".format(
|
||||||
|
relpath,
|
||||||
|
len(topHeadlines),
|
||||||
|
'with' if related is not None else 'without'
|
||||||
|
))
|
||||||
|
|
||||||
for headline in headlines:
|
for headline in headlines:
|
||||||
endpath = os.path.join(dest_top, headline.id + ".node.html")
|
endpath = os.path.join(dest_top, headline.id + ".node.html")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user