summaryrefslogtreecommitdiffstats
path: root/lps_gen.py
diff options
context:
space:
mode:
authorrsiddharth <rsd@gnu.org>2015-12-19 18:35:16 -0500
committerrsiddharth <rsd@gnu.org>2015-12-19 18:35:16 -0500
commit8bbbd13d95825e2b5590cf17f2829115e7537684 (patch)
tree6d576d867296f036a3105dbb62c888d6c94a1163 /lps_gen.py
parent19c1ac03e916561f2458312e5c9251b0b9eab075 (diff)
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.
Diffstat (limited to 'lps_gen.py')
-rw-r--r--lps_gen.py17
1 files changed, 15 insertions, 2 deletions
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__":