database_tools中教师版生成代码增加可选内容功能, 默认为都选
This commit is contained in:
parent
2e7d436a48
commit
47129199bc
|
|
@ -721,15 +721,15 @@ def GenerateStudentBodyString(problems,sectiontitles,pro_dict,consecutivenumberi
|
|||
return bodystring #返回主题内容字符串
|
||||
|
||||
|
||||
def TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple): #生成教师版讲义后的答案及空格, topandbottomusagestuple表示保留得分率最高的使用记录与最低的使用记录的个数, 有负数表示不排列
|
||||
def TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple = (3,3), showobjs = True, showtags = True, showans = True, showsolution = True, showusages = True, showorigin = True, showremark = True): #生成教师版讲义后的答案及空格, topandbottomusagestuple表示保留得分率最高的使用记录与最低的使用记录的个数, 有负数表示不排列
|
||||
string = ""
|
||||
objs = "目标:\n\n%s\n\n"%GenerateObjTexCode(id,prodict,objdict)
|
||||
tags = "标签: \\textcolor[rgb]{0.5,0.6,0.8}{%s}\n\n"%("; ".join(prodict[id]["tags"])) if not prodict[id]["tags"] == [] else "标签: \n\n"
|
||||
ans = "答案: \\textcolor{red}{%s}\n\n"%(prodict[id]["ans"] if prodict[id]["ans"] != "" else "暂无答案")
|
||||
solution = "解答或提示: \\textcolor{magenta}{%s}\n\n"%(prodict[id]["solution"] if prodict[id]["solution"] != "" else "暂无解答")
|
||||
origin = "来源: %s\n\n"%prodict[id]["origin"]
|
||||
remark = "备注: \\textcolor[rgb]{0,0.5,0.2}{%s}\n\n"%(prodict[id]["remark"] if prodict[id]["remark"] != "" else "暂无备注")
|
||||
usages = "使用记录:\n\n%s\n\n"%GenerateUsageTexCode(id,prodict,topandbottomusagestuple)
|
||||
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 ""
|
||||
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 ""
|
||||
usages = ("使用记录:\n\n%s\n\n"%GenerateUsageTexCode(id,prodict,topandbottomusagestuple)) if showusages else ""
|
||||
string += objs + tags + ans + solution + usages + origin + remark
|
||||
return string #生成教师版讲义后的答案及空格
|
||||
|
||||
|
|
@ -758,7 +758,7 @@ def GenerateUsageTexCode(id,prodict,topandbottomusagestuple): #根据topandbotto
|
|||
usagecode = re.sub("\\t([\d]\.[\d]{0,10})",GenerateValueColorCode,"\n\n".join(usages))
|
||||
return usagecode #返回缩减后的使用记录列表
|
||||
|
||||
def GenerateTeacherBodyString(problems,sectiontitles,prodict,objdict,consecutivenumbering = True,topandbottomusagestuple = (3,3),sectionname = "section"): #生成教师版的.tex文件的主体内容
|
||||
def GenerateTeacherBodyString(problems,sectiontitles,prodict,objdict,consecutivenumbering = True,topandbottomusagestuple = (3,3),sectionname = "section", showobjs = True, showtags = True, showans = True, showsolution = True, showusages = True, showorigin = True, showremark = True): #生成教师版的.tex文件的主体内容, 各项是否显示为可选
|
||||
bodystring = ""
|
||||
if len(problems) == len(sectiontitles):
|
||||
count = 0
|
||||
|
|
@ -767,7 +767,7 @@ def GenerateTeacherBodyString(problems,sectiontitles,prodict,objdict,consecutive
|
|||
sectionstring = "\\%s{%s}\n\\begin{enumerate}\n\\setcounter{enumi}{%d}\n\n"%(sectionname,sectiontitles[i],count if consecutivenumbering else 0)
|
||||
for id in idlist:
|
||||
count += 1
|
||||
aftercontent = TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple)
|
||||
aftercontent = TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple = topandbottomusagestuple, showobjs = showobjs, showtags = showtags, showans = showans, showsolution = showsolution, showusages = showusages, showorigin = showorigin, showremark = showremark)
|
||||
sectionstring += "\\item (%s) %s\n\n%s"%(id,prodict[id]["content"],aftercontent)
|
||||
sectionstring += "\\end{enumerate}"
|
||||
bodystring += sectionstring
|
||||
|
|
@ -776,7 +776,7 @@ def GenerateTeacherBodyString(problems,sectiontitles,prodict,objdict,consecutive
|
|||
idlist = generate_number_set(idstring,prodict)
|
||||
sectionstring = "\\begin{enumerate}\n\n"
|
||||
for id in idlist:
|
||||
aftercontent = TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple)
|
||||
aftercontent = TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple = topandbottomusagestuple, showobjs = showobjs, showtags = showtags, showans = showans, showsolution = showsolution, showusages = showusages, showorigin = showorigin, showremark = showremark)
|
||||
sectionstring += "\\item (%s) %s\n\n%s"%(id,prodict[id]["content"],aftercontent)
|
||||
sectionstring += "\\end{enumerate}"
|
||||
bodystring += sectionstring
|
||||
|
|
|
|||
Reference in New Issue