diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index f8b7a1b8..53c52b50 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -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"] diff --git a/工具v2/文本文件/config.json b/工具v2/文本文件/config.json index 0d4101a6..b249b131 100644 --- a/工具v2/文本文件/config.json +++ b/工具v2/文本文件/config.json @@ -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 } } \ No newline at end of file diff --git a/工具v2/系列讲义生成.py b/工具v2/系列讲义生成.py index 90e5fa0d..949a807b 100644 --- a/工具v2/系列讲义生成.py +++ b/工具v2/系列讲义生成.py @@ -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")