From a699f604b4e78c230a8cb00374fc370fc1801b67 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Wed, 28 Feb 2024 22:04:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E9=A2=98=E6=AF=94=E5=AF=B9=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E4=B8=8D=E9=9C=80=E8=A6=81=E9=80=89=E5=8F=96=E6=95=B4?= =?UTF-8?q?=E4=B8=AAlatex=E6=96=87=E4=BB=B6,=20=E9=80=89=E5=8F=96=E4=B8=80?= =?UTF-8?q?=E9=83=A8=E5=88=86\item=E5=BC=80=E5=A7=8B=E7=9A=84=E5=9D=97?= =?UTF-8?q?=E4=B9=9F=E5=8F=AF=E4=BB=A5=E8=BF=9B=E8=A1=8C=E6=96=B0=E9=A2=98?= =?UTF-8?q?=E6=AF=94=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/新题比对.py | 4 ++++ 1 file changed, 4 insertions(+) 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() == ""]