Example #1
0
    course = os.path.basename(here)

    import json, sys, yaml
    raw = yamlfile('cal.yaml')
    links = yamlfile('links.yaml') if os.path.exists('links.yaml') else {}
    cal = raw2cal(raw, links)
    with open('markdown/schedule-old.html', 'w') as fh:
        fh.write(cal2html(cal))
    with open('markdown/schedule.html', 'w') as fh:
        fh.write(cal2html2(cal))

    with open('markdown/cal.ics', 'w') as fh:
        fh.write(
            cal2ical(cal,
                     course,
                     raw['meta']['home'],
                     tz=raw['meta']['timezone']))

    import pjson
    with open('markdown/cal-oh.js', 'w') as fh:
        fh.write('oh_feed = ')
        fh.write(
            pjson.prettyjson(cal2fullcal(cal,
                                         keep=lambda x: x['kind'] == 'oh')))

    with open('assignments.json', 'w') as fh:
        print(pjson.prettyjson(cal2assigments(cal, raw)), file=fh)

    with open('coursegrade.json', 'w') as f:
        f.write(pjson.prettyjson(coursegrade_json(raw), maxinline=16))
Example #2
0
                        g = event['group']
                        dat = slug2asgn(s,g,raw)
                        dat['group'] = g
                        ans[s] = dict(**dat)
    return ans
    
if __name__ == '__main__':
    import os, os.path
    here = os.path.realpath(os.path.dirname(__file__))
    os.chdir(here)
    course = os.path.basename(here)


    import json, sys, yaml
    raw = yamlfile('cal.yaml')
    links = yamlfile('links.yaml') if os.path.exists('links.yaml') else {}
    cal = raw2cal(raw, links)
    with open('markdown/schedule.html', 'w') as fh:
        fh.write(cal2html(cal))

    with open('markdown/cal.ics', 'w') as fh:
        fh.write(cal2ical(cal, course, raw['meta']['home'], tz=raw['meta']['timezone']))

    import pjson
    with open('markdown/cal-oh.js', 'w') as fh:
        fh.write('oh_feed = ')
        fh.write(pjson.prettyjson(cal2fullcal(cal, keep=lambda x : x['kind'] == 'oh')))

    with open('assignments.json', 'w') as fh:
        print(pjson.prettyjson(cal2assigments(cal, raw)), file=fh)