系列讲义生成功能增加 是否编译单卷与是否编译合集 的设置

This commit is contained in:
weiye.wang 2024-02-05 23:37:08 +08:00
parent 2cab25e092
commit 0281bcbeb4
3 changed files with 17 additions and 14 deletions

View File

@ -1578,14 +1578,14 @@ def GenerateSingleLessonNote2024(id,notesdict,pro_dict,obj_dict,bk_dict,template
latex_data = StringSubstitute(r"<<[\s\S]*?待替换[\s\S]*?>>",latex_raw,(notetitle,output)) #替换标题和bodystring
SaveTextFile(latex_data,outputfilepath) #保存.tex文件
outputdir,filename = os.path.split(outputfilepath)
print(f"{filename}编译中...")
if XeLaTeXCompile(outputdir,filename):
print("编译成功")
return latex_data # 返回0
else:
print("编译失败")
return latex_data # 返回有错误的latex源代码
if misc["编译单个文件"] == True:
outputdir,filename = os.path.split(outputfilepath)
print(f"{filename}编译中...")
if XeLaTeXCompile(outputdir,filename):
print("编译成功")
else:
print("编译失败")
return latex_data # 返回有错误的latex源代码
def GenerateSingleLessonNote(id,notesdict,metadict,templatepath,outputfilepath,consecutivenumbering = False, answered = False): #20231215版讲义生成
notetitle = id + r" \ " + notesdict["notes"][id]["name"]

View File

@ -34,8 +34,8 @@
}
},
"系列讲义生成.py": {
"讲义标题格式": "E202601\\d{2}",
"输出路径": "26届材料",
"讲义标题格式": "\\w202601\\d{2}",
"输出路径": "d:/temp/各备课组材料",
"教师版": true,
"字段显示设置": {
"题后空间": true,
@ -47,7 +47,9 @@
"使用记录说明": "[a,b]表示显示最好的a个和最差b个, 有-2表示不显示, 无-2但有-1表示全部显示",
"来源": true,
"备注": true,
"届别": ["2026届高一10班","2026届高一12班"]
}
"届别": ["2026届"]
},
"编译单个文件": false,
"编译合集": true
}
}

View File

@ -53,7 +53,8 @@ mergedtext = StringSubstitute(r"<<待替换[\d]+>>",ReadTextFile("./模板文件
SaveTextFile(mergedtext,os.path.join(outputdir,f"合集{GetDate()}.tex"))
tocompile = input("需要编译合集吗?(Y/[N]):")
if tocompile[0].upper() == "Y":
if not "编译合集" in configjson or configjson["编译合集"] == False:
tocompile = input("需要编译合集吗?(Y/[N]):")
if configjson["编译合集"] == True or tocompile[0].upper() == "Y":
XeLaTeXCompile(outputdir,f"合集{GetDate()}.tex")