From a298c6e66eea3c11b5b72911d7ca09e1288c3418 Mon Sep 17 00:00:00 2001 From: Alex Salmon Date: Sat, 1 Aug 2020 00:24:42 +0200 Subject: [PATCH 1/2] 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) From 44035b1dbc854e97c6d0a7f114a02709c951124e Mon Sep 17 00:00:00 2001 From: Alex Salmon Date: Sat, 1 Aug 2020 14:06:53 +0200 Subject: [PATCH 2/2] Updated docs --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4a90db2..eb4201d 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,10 @@ A lecture file contains a line ``` which is the lecture number, date an title of the lecture. Date format is configurable in `config.py`. +#### `init-all-courses.py` + +This is the first file you should run, after creating the directory and the `info.yaml` file for each course. It creates all `master.tex` files. + #### `config.py` This is where you configure what calendar to use for the countdown script, the root folder of the file structure, and similar stuff. You can also configure the date format used in some places (lecture selection dialog and LaTeX files).