Skip to content

fix(doc2md): preserve OMML formula content - #18419

Open
FOWEPJF255 wants to merge 3 commits into
PaddlePaddle:mainfrom
FOWEPJF255:fix/omml-optional-properties-18408
Open

FOWEPJF255 wants to merge 3 commits into
PaddlePaddle:mainfrom
FOWEPJF255:fix/omml-optional-properties-18408

Conversation

@FOWEPJF255

@FOWEPJF255 FOWEPJF255 commented Oct 26, 2026 •

Copy link
Copy Markdown

Summary

Three OMML conversion paths can silently lose valid formula content because convert_omath returns an empty string after a handler exception or an operand is overwritten:

  • Optional accPr, barPr, dPr, groupChrPr, and fName nodes may be absent. Use existing formatting defaults or retain the function expression.
  • A delimiter may contain multiple m:e children. Collect all operands and render sepChr between them, including a \middle| for a vertical bar.
  • A limLow base outside lim, min, and max previously raised. Render common inf, sup, and gcd operators directly and preserve other bases with \underset.

Fixes #18408, #18409, #18410.

Validation

  • Before the change, the five missing-property cases raised KeyError or AttributeError, multi-expression delimiters retained only their last operand, and unsupported limLow bases raised RuntimeError.
  • python -m pytest tests/unit/test_doc2md_omml.py tests/unit/test_doc2md_omml_delimiter.py -q — 15 passed.
  • Black 24.10.0 check, the repository's selected Flake8 rules, and git diff --check passed.

@FOWEPJF255 FOWEPJF255 changed the title fix(doc2md): preserve OMML formulas without optional properties fix(doc2md): preserve OMML formula content Oct 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc2md: OMML formulas are silently dropped when optional property elements (accPr/barPr/dPr/groupChrPr/fName) are absent

1 participant