database_tools中生成讲义里讲义只有一个section时不加标题

This commit is contained in:
wangweiye7840 2023-12-18 13:02:01 +08:00
parent e455bf9a07
commit 10f44bb422
1 changed files with 2 additions and 1 deletions

View File

@ -1273,7 +1273,8 @@ def GenerateSingleLessonNote(id,notesdict,metadict,templatepath,outputfilepath,c
paragraphs = [p for p in rawoutput.split("\\section") if not p.strip() == ""]
for item in paragraphs:
sectionkey, content = re.findall(r"\{([\S]*)\}\n([\S\s]*)$",item)[0]
output += "\\section{" + structure[sectionkey]["name"] + "}\n\n"
if not len(paragraphs) == 1:
output += "\\section{" + structure[sectionkey]["name"] + "}\n\n"
if not structure[sectionkey]["spaceflag"] or answered:
content = re.sub(r"\\vspace[\*]?\{[\S]*\}","\n",content)
output += content + "\n\n"