From 8bbbd13d95825e2b5590cf17f2829115e7537684 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 19 Dec 2015 18:35:16 -0500 Subject: updated lps_gen.main The function now reads the LP `year` and the path to the LP schedule markdown file from the commandline and stdouts the HTML version of the LP schedule. --- lps_gen.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'lps_gen.py') diff --git a/lps_gen.py b/lps_gen.py index 8a8c006..bdfbe63 100644 --- a/lps_gen.py +++ b/lps_gen.py @@ -169,14 +169,27 @@ def RenderHTML(lps_dict, year): def main(): parser = ArgumentParser() + parser.add_argument("year", + help="LP Schedule year.") parser.add_argument("lps_md", help="Path to the markdown version of LP Schedule.") args = parser.parse_args() lps_md_content = read_file(path.abspath(args.lps_md)) + lp_year = args.year - markdown = LPSMarkdown() - lps_dict = markdown(lps_md_content) + if lps_md_content: + markdown = LPSMarkdown() + lps_dict = markdown(lps_md_content) + lps_html = RenderHTML(lps_dict, lp_year) + else: + exit(1) + + if lps_html: + # stdout lps html + print lps_html + else: + print 'Error generating LP HTML.' if __name__ == "__main__": -- cgit v1.2.3