move lecture start / end markers and new lecture header to config file
This commit is contained in:
parent
99f955246b
commit
d0b58a5a79
3 changed files with 7 additions and 5 deletions
|
@ -23,3 +23,6 @@ COURSE_IGNORE_FILE = '.courseignore'
|
||||||
COURSE_INFO_FILE = 'info.yaml'
|
COURSE_INFO_FILE = 'info.yaml'
|
||||||
DEFAULT_MASTER_FILE_NAME = 'master.tex'
|
DEFAULT_MASTER_FILE_NAME = 'master.tex'
|
||||||
MAX_LEN = 40
|
MAX_LEN = 40
|
||||||
|
LECTURE_START_MARKER = 'start lectures'
|
||||||
|
LECTURE_END_MARKER = 'end lectures'
|
||||||
|
DEFAULT_NEW_LECTURE_HEADER = r'\lecture{{{number}}}{{{date}}}{{}}'
|
||||||
|
|
|
@ -5,7 +5,7 @@ import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from config import get_week, DATE_FORMAT, LOCALE, DEFAULT_MASTER_FILE_NAME
|
from config import get_week, DATE_FORMAT, LOCALE, DEFAULT_MASTER_FILE_NAME, DEFAULT_NEW_LECTURE_HEADER
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
locale.setlocale(locale.LC_TIME, LOCALE)
|
locale.setlocale(locale.LC_TIME, LOCALE)
|
||||||
|
@ -110,11 +110,10 @@ class Lectures(list):
|
||||||
date = today.strftime(DATE_FORMAT)
|
date = today.strftime(DATE_FORMAT)
|
||||||
|
|
||||||
new_lecture_path.touch()
|
new_lecture_path.touch()
|
||||||
new_lecture_path.write_text(f'\\lecture{{{new_lecture_number}}}{{{date}}}{{}}\n')
|
new_lecture_path.write_text(DEFAULT_NEW_LECTURE_HEADER.format(number=new_lecture_number, date=date))
|
||||||
|
|
||||||
self.read_files()
|
self.read_files()
|
||||||
|
|
||||||
lec = Lecture(new_lecture_path, self.course)
|
lec = Lecture(new_lecture_path, self.course)
|
||||||
|
|
||||||
return lec
|
return lec
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Notes:
|
||||||
with filepath.open() as f:
|
with filepath.open() as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
# order of if-statements is important here!
|
# order of if-statements is important here!
|
||||||
if 'end lectures' in line:
|
if LECTURE_END_MARKER in line:
|
||||||
part = 2
|
part = 2
|
||||||
|
|
||||||
if part == 0:
|
if part == 0:
|
||||||
|
@ -43,7 +43,7 @@ class Notes:
|
||||||
if part == 2:
|
if part == 2:
|
||||||
footer += line
|
footer += line
|
||||||
|
|
||||||
if 'start lectures' in line:
|
if LECTURE_START_MARKER in line:
|
||||||
part = 1
|
part = 1
|
||||||
return header, footer
|
return header, footer
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue