diff --git a/_scripts/generate.py b/_scripts/generate.py index 9f997af..5a9ad2d 100644 --- a/_scripts/generate.py +++ b/_scripts/generate.py @@ -83,6 +83,24 @@ def main(src_top, dest_top): # print("Skip:", relpath) 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: endpath = os.path.join(dest_top, headline.id + ".node.html")