Merge pull request #8 from SalmonA/master
Adding script to initialize all courses
This commit is contained in:
commit
16ec634e1c
2 changed files with 24 additions and 0 deletions
|
@ -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`.
|
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`
|
#### `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).
|
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).
|
||||||
|
|
20
scripts/init-all-courses.py
Normal file
20
scripts/init-all-courses.py
Normal file
|
@ -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)
|
Loading…
Reference in a new issue