diff --git a/工具v2/新题比对.py b/工具v2/新题比对.py index 2e5cf2d2..efebd527 100644 --- a/工具v2/新题比对.py +++ b/工具v2/新题比对.py @@ -9,6 +9,10 @@ templatepath = ".\模板文件\讲义模板.txt" pro_dict = load_dict("../题库0.3/problems.json") treated_dict = treat_dict(pro_dict) data_raw = getCopy() +if data_raw.strip().startswith("\\item"): + data_raw = "\\begin{enumerate}\n"+data_raw +if data_raw.count("\\begin{enumerate}") == data_raw.count("\\end{enumerate}") + 1: + data_raw = data_raw + "\n\\end{enumerate}" problems_raw = re.findall(r"\\begin\{enumerate\}([\s\S]*?)\\end\{enumerate\}",data_raw) data = "\n".join([item.strip() for item in problems_raw]) problems = [(d.strip()) for d in data.split("\\item") if not d.strip() == ""]