From 0419513560c98dd0c1fb69a76c72b28b8a1ef584 Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Thu, 10 Jul 2025 10:45:26 +0800 Subject: [PATCH] 'commit' --- dsLightRag/ShiTi/T3_DocxToMd.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dsLightRag/ShiTi/T3_DocxToMd.py b/dsLightRag/ShiTi/T3_DocxToMd.py index 8265946d..8c3cb6ef 100644 --- a/dsLightRag/ShiTi/T3_DocxToMd.py +++ b/dsLightRag/ShiTi/T3_DocxToMd.py @@ -79,11 +79,13 @@ async def main(): """ 修正一下MinerU生成的Latex中,如果是数字加圆圈的样式 \textcircled{1},无法在Typora或者PyCharm中显示的问题,改成兼容性更强的 \enclose{circle}{1} """ - - finalName = r'D:\dsWork\dsProject\dsRagAnything\output\《动能定理》巩固练习\auto\《动能定理》巩固练习.md' + # \textcircled + finalName = r'D:\\dsWork\\dsProject\\dsRagAnything\\output\\《动能定理》巩固练习\\auto\\《动能定理》巩固练习.md' with open(finalName, 'r', encoding='utf-8') as f: content = f.read() - content = content.replace(r'\textcircled', r'\enclose{circle}') + # 使用正则表达式匹配可能包含空格的命令格式 + import re + content = re.sub(r'\\textcircled\s*\{([0-9]+)\}', r'\\enclose{circle}{\1}', content) with open(finalName, 'w', encoding='utf-8') as f: f.write(content)