remove debug msg

This commit is contained in:
binary-husky
2024-06-07 17:00:05 +00:00
parent 612caa2f5f
commit 737101b81d

View File

@@ -212,15 +212,13 @@ def fix_code_segment_indent(txt):
def fix_dollar_sticking_bug(txt): def fix_dollar_sticking_bug(txt):
""" """
修复不标准的dollar符号的问题 修复不标准的dollar公式符号的问题
""" """
txt_result = "" txt_result = ""
single_stack_height = 0 single_stack_height = 0
double_stack_height = 0 double_stack_height = 0
while True: while True:
while True: while True:
# still has $
# how many dollar
index = txt.find('$') index = txt.find('$')
if index == -1: if index == -1:
@@ -229,14 +227,14 @@ def fix_dollar_sticking_bug(txt):
if single_stack_height > 0: if single_stack_height > 0:
if txt[:(index+1)].find('\n') > 0 or txt[:(index+1)].find('<td>') > 0 or txt[:(index+1)].find('</td>') > 0: if txt[:(index+1)].find('\n') > 0 or txt[:(index+1)].find('<td>') > 0 or txt[:(index+1)].find('</td>') > 0:
print('公式之中出现了异常换行 unexpect new line in equation') print('公式之中出现了异常 (Unexpect element in equation)')
single_stack_height = 0 single_stack_height = 0
txt_result += ' $' txt_result += ' $'
continue continue
if double_stack_height > 0: if double_stack_height > 0:
if txt[:(index+1)].find('\n\n') > 0: if txt[:(index+1)].find('\n\n') > 0:
print('公式之中出现了异常换行 unexpect new line in equation') print('公式之中出现了异常 (Unexpect element in equation)')
double_stack_height = 0 double_stack_height = 0
txt_result += '$$' txt_result += '$$'
continue continue
@@ -255,15 +253,13 @@ def fix_dollar_sticking_bug(txt):
txt = txt[(index+2):] txt = txt[(index+2):]
else: else:
if double_stack_height != 0: if double_stack_height != 0:
print(txt[:(index)]) # print(txt[:(index)])
print('Fatal') print('发现异常嵌套公式')
if single_stack_height == 0: if single_stack_height == 0:
single_stack_height = 1 single_stack_height = 1
else: else:
single_stack_height = 0 single_stack_height = 0
print(txt[:(index)]) # print(txt[:(index)])
import time
# time.sleep(0.1)
txt_result += txt[:(index+1)] txt_result += txt[:(index+1)]
txt = txt[(index+1):] txt = txt[(index+1):]
break break