introduce yaml config parameter for master file name

Specify a line master_file: 'name.tex' in your yaml.info in some
course directory to change the name of the master file that is used
This commit is contained in:
Maximilian Keßler 2021-09-16 13:08:05 +02:00
parent 8d57fd37f5
commit cd28d026fe
2 changed files with 6 additions and 2 deletions

View file

@ -19,3 +19,4 @@ DATE_FORMAT = '%a %d %b %Y %H:%M'
LOCALE = "de_DE.utf8" LOCALE = "de_DE.utf8"
COURSE_IGNORE_FILE = '.courseignore' COURSE_IGNORE_FILE = '.courseignore'
COURSE_INFO_FILE = 'info.yaml' COURSE_INFO_FILE = 'info.yaml'
DEFAULT_MASTER_FILE_NAME = 'master.tex'

View file

@ -8,7 +8,7 @@ import re
import subprocess import subprocess
from config import get_week, DATE_FORMAT, CURRENT_COURSE_ROOT, LOCALE from config import get_week, DATE_FORMAT, CURRENT_COURSE_ROOT, LOCALE, DEFAULT_MASTER_FILE_NAME
# TODO # TODO
locale.setlocale(locale.LC_TIME, LOCALE) locale.setlocale(locale.LC_TIME, LOCALE)
@ -58,7 +58,10 @@ class Lectures(list):
def __init__(self, course): def __init__(self, course):
self.course = course self.course = course
self.root = course.path self.root = course.path
self.master_file = self.root / 'master.tex' if 'master_file' in course.info:
self.master_file = self.root / course.info['master_file']
else:
self.master_file = self.root / DEFAULT_MASTER_FILE_NAME
list.__init__(self, self.read_files()) list.__init__(self, self.read_files())
def read_files(self): def read_files(self):