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

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

View File

@ -34,8 +34,8 @@
} }
}, },
"系列讲义生成.py": { "系列讲义生成.py": {
"讲义标题格式": "E202601\\d{2}", "讲义标题格式": "\\w202601\\d{2}",
"输出路径": "26届材料", "输出路径": "d:/temp/各备课组材料",
"教师版": true, "教师版": true,
"字段显示设置": { "字段显示设置": {
"题后空间": true, "题后空间": true,
@ -47,7 +47,9 @@
"使用记录说明": "[a,b]表示显示最好的a个和最差b个, 有-2表示不显示, 无-2但有-1表示全部显示", "使用记录说明": "[a,b]表示显示最好的a个和最差b个, 有-2表示不显示, 无-2但有-1表示全部显示",
"来源": true, "来源": true,
"备注": 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")) SaveTextFile(mergedtext,os.path.join(outputdir,f"合集{GetDate()}.tex"))
tocompile = input("需要编译合集吗?(Y/[N]):") if not "编译合集" in configjson or configjson["编译合集"] == False:
if tocompile[0].upper() == "Y": tocompile = input("需要编译合集吗?(Y/[N]):")
if configjson["编译合集"] == True or tocompile[0].upper() == "Y":
XeLaTeXCompile(outputdir,f"合集{GetDate()}.tex") XeLaTeXCompile(outputdir,f"合集{GetDate()}.tex")