From 0281bcbeb4084077c50688b61c63037dd009fa82 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Mon, 5 Feb 2024 23:37:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E5=88=97=E8=AE=B2=E4=B9=89=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=83=BD=E5=A2=9E=E5=8A=A0=20=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E7=BC=96=E8=AF=91=E5=8D=95=E5=8D=B7=E4=B8=8E=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E7=BC=96=E8=AF=91=E5=90=88=E9=9B=86=20=E7=9A=84?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 16 ++++++++-------- 工具v2/文本文件/config.json | 10 ++++++---- 工具v2/系列讲义生成.py | 5 +++-- 3 files changed, 17 insertions(+), 14 deletions(-) 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")