From a78e62f61aefa7e9536280b42e2b5bfbd29e4a11 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Wed, 7 Feb 2024 12:39:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20generateLaTeXBodyContent?= =?UTF-8?q?=20=E7=9A=84=E8=AE=BE=E7=BD=AE,=20misc=E4=B8=BA{}=E6=97=B6?= =?UTF-8?q?=E5=8F=AF=E7=94=9F=E6=88=90=E5=8F=AA=E6=9C=89=E9=A2=98=E5=8F=B7?= =?UTF-8?q?=E5=92=8C=E9=A2=98=E7=9B=AE=E5=86=85=E5=AE=B9=E7=9A=84\item=20?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index d191bfe7..2cc33b12 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -1046,12 +1046,12 @@ def generateLaTeXBodyContent(id,adict,objdict,misc): #根据id,读取的json内 # } # } id = str(id).zfill(6) - if misc["教师版"] == False: + if not "教师版" in misc or misc["教师版"] == False: output = f"\n\\item {{\\tiny ({id})}} {adict[id]['content']}" - if "答案" in misc["字段显示设置"] and misc["字段显示设置"]["答案"] == True: + if "字段显示设置" in misc and "答案" in misc["字段显示设置"] and misc["字段显示设置"]["答案"] == True: ans = adict[id]["ans"] if len(adict[id]["ans"]) > 0 else "暂无答案" output += f"\n\n答案: \\textcolor{{red}}{{{ans}}}\n\n" - if "题后空间" in misc["字段显示设置"] and misc["字段显示设置"]["题后空间"] == True: + if "字段显示设置" in misc and "题后空间" in misc["字段显示设置"] and misc["字段显示设置"]["题后空间"] == True: space = f"\n\n\\vspace*{{{adict[id]['space']}}}\n\n" if len(adict[id]["space"]) > 0 else "" output += space else: