fix: 调整处理顺序保留英文空格的同时修复markdown被识别为纯ASCII 字符的错误返回

This commit is contained in:
Sakura-RanChen
2026-04-17 10:59:29 +08:00
parent 6348f12d60
commit d2cbec0981
+5 -5
View File
@@ -130,17 +130,17 @@ class MarkdownCleaner:
"""
主入口方法:依序执行所有正则,移除或替换 Markdown 元素
"""
# 检查文本是否全为英文和基本标点符号
if text and all((c.isascii() or c.isspace() or c in punctuation_set) for c in text):
# 保留原始空格,直接返回
return text
for regex, replacement in MarkdownCleaner.REGEXES:
text = regex.sub(replacement, text)
# 去除emoji表情
text = check_emoji(text)
# 检查文本是否全为英文和基本标点符号
if text and all((c.isascii() or c.isspace() or c in punctuation_set) for c in text):
# 保留原始空格,直接返回
return text
return text.strip()
def convert_percentage_to_range(percentage, min_val, max_val, base_val=None):