From a298c6e66eea3c11b5b72911d7ca09e1288c3418 Mon Sep 17 00:00:00 2001 From: Alex Salmon Date: Sat, 1 Aug 2020 00:24:42 +0200 Subject: [PATCH] added file to initialize all courses --- scripts/init-all-courses.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 scripts/init-all-courses.py diff --git a/scripts/init-all-courses.py b/scripts/init-all-courses.py new file mode 100644 index 0000000..f7397fb --- /dev/null +++ b/scripts/init-all-courses.py @@ -0,0 +1,20 @@ +#!/bin/python3 +from courses import Courses + +for course in Courses(): + lectures = course.lectures + course_title = lectures.course.info["title"] + lines = [r'\documentclass[a4paper]{article}', + r'\input{../preamble.tex}', + fr'\title{{{course_title}}}', + r'\begin{document}', + r' \maketitle', + r' \tableofcontents', + fr' % start lectures', + fr' % end lectures', + r'\end{document}' + ] + lectures.master_file.touch() + lectures.master_file.write_text('\n'.join(lines)) + (lectures.root / 'master.tex.latexmain').touch() + (lectures.root / 'figures').mkdir(exist_ok=True)