formula remove space

master
ZouJiu 2023-10-21 21:45:55 +08:00
parent f7f59b53d9
commit 17055b25e9
1 changed files with 10 additions and 4 deletions

View File

@ -345,10 +345,16 @@ def parser_beautiful(innerHTML, article, number, dircrea, bk=False):
if 'class' in chi.attrs.keys(): if 'class' in chi.attrs.keys():
classc = chi.attrs["class"] classc = chi.attrs["class"]
if datatex and classc and 'ztext-math' in classc: if datatex and classc and 'ztext-math' in classc:
content = chi.attrs["data-tex"]
while len(content) > 0 and ' '==content[0]:
content = content[1:]
while len(content) > 0 and ' '==content[-1]:
content = content[:-1]
if len(content) > 0:
if article[-3-1:]=='<br>' or article[-1:]=='\n': if article[-3-1:]=='<br>' or article[-1:]=='\n':
article += "\n$" + chi.attrs["data-tex"] + "$" article += "\n$" + content + "$"
else: else:
article += "$" + chi.attrs["data-tex"] + "$" article += "$" + content + "$"
else: else:
article, number = parser_beautiful(chi, article, number, dircrea, bk) article, number = parser_beautiful(chi, article, number, dircrea, bk)
# article += nod.text # article += nod.text