move default new lecture title into config

This commit is contained in:
Maximilian Keßler 2021-09-17 10:45:14 +02:00
parent 10a8a42b84
commit 78ff6c693a
2 changed files with 5 additions and 2 deletions

View file

@ -20,6 +20,7 @@ MAX_LEN = 40
LECTURE_START_MARKER = 'start lectures'
LECTURE_END_MARKER = 'end lectures'
DEFAULT_NEW_LECTURE_HEADER = r'\lecture[]{{{date}}}{{{title}}}'
DEFAULT_NEW_LECTURE_TITLE = 'Untitled'
DEFAULT_LECTURE_SEARCH_REGEX = r'lecture.*({\d*})?{(.*?)}{(.*)}'
DEFAULT_IMPORT_INDENTATION = 4
FALLBACK_COURSE_INFO_FILE = Path('fallback.yaml').resolve()

View file

@ -5,7 +5,8 @@ import re
import warnings
from datetime import datetime
from config import DATE_FORMAT, LOCALE, DEFAULT_NEW_LECTURE_HEADER, DEFAULT_LECTURE_SEARCH_REGEX
from config import DATE_FORMAT, LOCALE, DEFAULT_NEW_LECTURE_HEADER, DEFAULT_LECTURE_SEARCH_REGEX, \
DEFAULT_NEW_LECTURE_TITLE
from utils import get_week
from edit import edit
@ -117,7 +118,8 @@ class Lectures(list):
date = today.strftime(DATE_FORMAT)
vimtex_root_str = f"%! TEX root = {str(os.path.relpath(self.notes.master_file, self.root))}\n"
header_str = DEFAULT_NEW_LECTURE_HEADER.format(number=new_lecture_number, date=date, title='Untitled')
header_str = DEFAULT_NEW_LECTURE_HEADER.format(
number=new_lecture_number, date=date, title=DEFAULT_NEW_LECTURE_TITLE)
new_lecture_path.touch()
new_lecture_path.write_text(vimtex_root_str + header_str)