根据json文件生成讲义的功能修改为根据正则表达式, 而不是单课的题号
This commit is contained in:
parent
dfc9a66008
commit
6741db4e3b
10
工具v2/讲义生成.py
10
工具v2/讲义生成.py
|
|
@ -1,5 +1,5 @@
|
|||
notes_dict_path = "../备课组/公共/年级讲义模板.json" # 讲义(题,基础知识,目标)号码所在json数据库路径
|
||||
lessonid = "G20260101" # 数据库中讲义的编号([A-Z][0-9]{4}[(01)|(02)][[0-9]{2}), 字母表示类型, 四位数字表示届别, 2位数字表示学期及其他, 2位数字表示序号
|
||||
notes_dict_path = "../备课组/25届/校本材料.json" # 讲义(题,基础知识,目标)号码所在json数据库路径
|
||||
lessonpattern = r"H202503\d{2}" # 正则表达式, 数据库中讲义的编号([A-Z][0-9]{4}[(01)|(02)][[0-9]{2}), 字母表示类型, 四位数字表示届别, 2位数字表示学期及其他, 2位数字表示序号
|
||||
outputdir = "临时文件" # 输出文件夹, 不建议修改
|
||||
answered = False # 设置是否编译答案
|
||||
consecutivenumbering = False # 设置是否用连续编号, 试卷请设为True, 普通讲义请设为False
|
||||
|
|
@ -15,5 +15,7 @@ dictionaries = {}
|
|||
for t in (obj_dict,basicknowledge_dict,pro_dict):
|
||||
dictionaries.update(t)
|
||||
|
||||
filename = notes_dict["notes"][lessonid]["id"]+notes_dict["notes"][lessonid]["filename"]+".tex"
|
||||
GenerateSingleLessonNote(id = lessonid,notesdict = notes_dict, metadict = dictionaries, templatepath = ".\模板文件\讲义模板.txt", outputfilepath = os.path.join(outputdir,filename),consecutivenumbering=consecutivenumbering,answered=answered)
|
||||
for lessonid in notes_dict["notes"]:
|
||||
if re.findall(lessonpattern,lessonid) != []:
|
||||
filename = notes_dict["notes"][lessonid]["id"]+notes_dict["notes"][lessonid]["filename"]+".tex"
|
||||
GenerateSingleLessonNote(id = lessonid,notesdict = notes_dict, metadict = dictionaries, templatepath = ".\模板文件\讲义模板.txt", outputfilepath = os.path.join(outputdir,filename),consecutivenumbering=consecutivenumbering,answered=answered)
|
||||
Reference in New Issue