This repository has been archived on 2024-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
mathdeptv2/工具v2/json编辑题目综合信息.py

24 lines
819 B
Python

id_string = "21370:21371"
editor = "王伟叶"
from database_tools import *
prodictpath = "../题库0.3/Problems.json"
pro_dict = load_dict(prodictpath)
obj_dict = load_dict("../题库0.3/LessonObj.json")
pro_dict_raw_string = ReadTextFile(prodictpath)
configjson = load_dict("文本文件/config.json")["默认完整编译题目模式"]
editedid_list = jsonEditProblemMetadata(id_string,pro_dict,editor)
save_dict(pro_dict,prodictpath)
print("题号 %s 已编辑."%editedid_list)
if not XeLaTeXTest(editedid_list,pro_dict,obj_dict,configjson,templatepath="模板文件/讲义模板.txt",outdir = "临时文件",outfile = "problems_test.tex"):
SaveTextFile(pro_dict_raw_string,"../题库0.3/Problems.json")
print("编译失败, 题库文件退回原状")
else:
print("编译成功, 已汇入题库")