INNER CODE UNIT · Python
write_papers
junyanz/CatPapers · compile_cat_papers.py:163
def write_papers(papers, header_file=None, end_file=None, TYPE="md"):
mtd_str = "write_" + TYPE.lower()
content = ""
# add header file
if header_file and os.path.exists(header_file):
with open(header_file, "r") as hfile:
content = hfile.read()
content += "\n<br>\n\n"
for paper in papers:
content = getattr(paper, mtd_str)(content)
content += "\n<br>\n\n"
content = add_date(content)
content += "\n<br>\n\n"
if end_file and os.path.exists(end_file):
with open(end_file, "r") as efile:
content += efile.read()