暂无答案的显示调整为蓝色, 与收录新答案的工作相匹配

This commit is contained in:
weiye.wang 2024-02-10 14:07:25 +08:00
parent 7d201758f1
commit 2a3bc54605
2 changed files with 8 additions and 8 deletions

View File

@ -873,7 +873,7 @@ def StudentsGetAfterContent(id,prodict,answered,spaceflag): #生成学生版讲
string = ""
if "ans" in prodict[id]:
if answered:
string += "答案: \\textcolor{red}{%s}\n\n"%(prodict[id]["ans"] if prodict[id]["ans"] != "" else "暂无答案")
string += "答案: \\textcolor{%s}{%s}\n\n"%(("red",prodict[id]["ans"]) if prodict[id]["ans"] != "" else ("blue","暂无答案"))
if spaceflag:
if "space" in prodict[id]:
if prodict[id]["space"] != "":
@ -992,7 +992,7 @@ def TeachersGetAfterContentPlain(id,prodict,objdict,topandbottomusagestuple = (3
string = ""
objs = ("目标:\n\n%s\n\n"%GenerateObjTexCode(id,prodict,objdict)) if showobjs else ""
tags = ("标签: \\textcolor[rgb]{0.5,0.6,0.8}{%s}\n\n"%("; ".join(prodict[id]["tags"])) if not prodict[id]["tags"] == [] else "标签: \n\n") if showtags else ""
ans = ("答案: \\textcolor{red}{%s}\n\n"%(prodict[id]["ans"] if prodict[id]["ans"] != "" else "暂无答案")) if showans else ""
ans = ("答案: \\textcolor{%s}{%s}\n\n"%(("red",prodict[id]["ans"]) if prodict[id]["ans"] != "" else ("blue","暂无答案"))) if showans else ""
solution = ("解答或提示: \\textcolor{magenta}{%s}\n\n"%(prodict[id]["solution"] if prodict[id]["solution"] != "" else "暂无解答")) if showsolution else ""
origin = ("来源: %s\n\n"%prodict[id]["origin"]) if showorigin else ""
remark = ("备注: \\textcolor[rgb]{0,0.5,0.2}{%s}\n\n"%(prodict[id]["remark"] if prodict[id]["remark"] != "" else "暂无备注")) if showremark else ""
@ -1052,7 +1052,7 @@ def generateLaTeXBodyContent(id,adict,objdict,misc): #根据id,读取的json内
output = f"\n\\item {{\\tiny ({id})}} {adict[id]['content']}"
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"
output += f"\n\n答案: \\textcolor{{{('red' if ans != '暂无答案' else 'blue')}}}{{{ans}}}\n\n"
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
@ -1073,7 +1073,7 @@ def generateLaTeXBodyContent(id,adict,objdict,misc): #根据id,读取的json内
output += f"\n\n标签: \\textcolor[rgb]{{0.5,0.6,0.8}}{{{tags}}}\n\n"
if "答案" 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"
output += f"\n\n答案: \\textcolor{{{('red' if ans != '暂无答案' else 'blue')}}}{{{ans}}}\n\n"
if "解答与提示" in misc["字段显示设置"] and misc["字段显示设置"]["解答与提示"] == True:
solution = adict[id]["solution"] if len(adict[id]["solution"]) > 0 else "暂无解答或提示"
output += f"\n\n解答或提示: \\textcolor{{magenta}}{{{solution}}}\n\n"

View File

@ -9,7 +9,7 @@
"提供答案": true
},
"讲义生成.py": {
"讲义标题格式": "V202503\\d{2}",
"讲义标题格式": "G2025034\\d",
"输出路径": "临时文件",
"提供答案": true
},
@ -34,9 +34,9 @@
}
},
"系列讲义生成.py": {
"讲义标题格式": "\\w202601\\d{2}",
"讲义标题格式": "G202602\\d{2}",
"输出路径": "d:/temp/各备课组材料",
"教师版": true,
"教师版": false,
"字段显示设置": {
"题后空间": true,
"课时目标": true,
@ -71,7 +71,7 @@
"文件或剪贴板提取答案.py": {
"来自剪贴板": true,
"文件地址": "d:/temp/test5.tex",
"前缀": "答案: \\textcolor{red}{"
"前缀": "答案: \\textcolor{blue}{"
},
"单元挂钩.py": {
"阶段": 2,