add fallback.yaml to git. Get rid of nasty error handling in Notes class since now we have a fallback file

This commit is contained in:
Maximilian Keßler 2021-09-17 10:37:47 +02:00
parent 5a2fa4494e
commit 602f6e4323
3 changed files with 26 additions and 18 deletions

View file

@ -22,4 +22,4 @@ LECTURE_END_MARKER = 'end lectures'
DEFAULT_NEW_LECTURE_HEADER = r'\lecture[]{{{date}}}{{{title}}}'
DEFAULT_LECTURE_SEARCH_REGEX = r'lecture.*({\d*})?{(.*?)}{(.*)}'
DEFAULT_IMPORT_INDENTATION = 4
FALLBACK_COURSE_INFO_FILE = Path('info.yaml').resolve()
FALLBACK_COURSE_INFO_FILE = Path('fallback.yaml').resolve()

20
scripts/fallback.yaml Normal file
View file

@ -0,0 +1,20 @@
title: 'Unnamed course'
short: 'unnamed'
language: 'english'
links:
url: ''
ecampus: ''
sciebo: ''
basis: ''
github: ''
exercises:
path: 'ub'
name: 'Maximilian Keßler'
literature:
path: 'doc'
notes:
path: '.'
master_file: 'master.tex'
full_file: 'full.tex'
lectures:
path: '.'

View file

@ -11,23 +11,11 @@ from edit import edit
class Notes:
def __init__(self, course):
self.course = course
if 'notes' in course.info:
self.info = course.info['notes']
else:
self.info = []
if 'path' in self.info:
self.root = course.path / self.info['path']
self.root.mkdir(parents=True, exist_ok=True)
else:
self.root = course.path
if 'master_file' in self.info:
self.master_file = self.root / self.info['master_file']
else:
self.master_file = self.root / DEFAULT_MASTER_FILE_NAME
if 'full_file' in self.info:
self.full_file: Path = self.root / self.info['full_file']
else:
self.full_file: Path = None
self.full_file = self.root / self.info['full_file']
self._lectures = None
@staticmethod