lpschedule-generator

libreplanet schedule generator - ricketyspace.net/lpschedule-generator
git clone git://git.ricketyspace.net/lpschedule-generator.git
Log | Files | Refs

commit 99316030cbc945cecce7d07f7b2efe4c1702d6d1
parent 8c9ac2143c367dd54bafc8bbce4bbf50a2066288
Author: rsiddharth <rsd@gnu.org>
Date:   Sun, 13 Dec 2015 11:54:56 -0500

lps_gen: introduced main()

main() reads a markdown version of LP schedule, converts it into a
python dictionary and stdouts the json version of the python dictionary.

Diffstat:
lps_gen.py | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/lps_gen.py b/lps_gen.py @@ -18,6 +18,9 @@ # along with lpschedule-generator (see COPYING). If not, see # <http://www.gnu.org/licenses/>. +import json + +from argparse import ArgumentParser from collections import OrderedDict from os import path @@ -128,3 +131,21 @@ class LPSMarkdown(Markdown): lps_dict = OrderedDict() html = super(LPSMarkdown, self).parse(text) return lps_dict + + +def main(): + parser = ArgumentParser() + 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)) + + markdown = LPSMarkdown() + lps_dict = markdown(lps_md_content) + + print json.dumps(lps_dict, indent=4) + + +if __name__ == "__main__": + main()