fix: 修复 OMML 多字母标识符被空格拆开(BC → B C) #1
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题现象
Word 里连写的多字母标识符,经 OMML2MML.xsl 转换后会被拆成相邻的
<mi>/<mn>元素,原转换器用空格 join,导致:B C = 2(渲染成 B×C)BC = 2\triangle A B C\triangle ABC4 5 ^\circ45^\circA B / / C DAB // CD根因
三处都用
' '.join(parts)把所有子元素硬性空格连接:visitors/mrow_visitor.py的_convert_children_with_spacescompat/legacy_adapter.py的<math>根节点多子元素处理(真实 docx 走这里,因为 OMML2MML 输出的 MathML 无<mrow>包裹)strategies/math_strategy.py的format_identifier(Unicode+字母混合内容,如<mi>△ABC</mi>)修复
<mi>(无 mathvariant)拼接为整体,先于 fragmented-function 检测之后执行\triangleA变未定义命令,同时保持ABC连写验证
test_mixed.docx(130 个 OMML 公式)修复前后对比:16 个公式发生变化,全部为正确改善(线段名/角度数字/三角形/隐式乘法拼接),零误伤。sin/log/x+1/2x/\frac等场景无回归。关联 commit:
d4c2fd1