Skip to content

feat(math): implement m:limLow and m:limUpp limit converters#2771

Merged
caio-pizzol merged 6 commits intosuperdoc-dev:mainfrom
gpardhivvarma:feat/math-lim-converters
Apr 12, 2026
Merged

feat(math): implement m:limLow and m:limUpp limit converters#2771
caio-pizzol merged 6 commits intosuperdoc-dev:mainfrom
gpardhivvarma:feat/math-lim-converters

Conversation

@gpardhivvarma
Copy link
Copy Markdown
Contributor

Summary

  • Implement m:limLow (lower limit) → <munder> converter per ECMA-376 §22.1.2.54
  • Implement m:limUpp (upper limit) → <mover> converter per ECMA-376 §22.1.2.56
  • Register both in MATH_OBJECT_REGISTRY and export from barrel file
  • Add 10 unit tests covering basic conversion, properties skipping, multi-part operand wrapping, and missing-child edge cases

Closes #2599 (SD-2377)
Closes #2600 (SD-2378)

Changes

File What
converters/lower-limit.ts New converter: m:limLow<munder> with m:e base + m:lim limit
converters/upper-limit.ts New converter: m:limUpp<mover> with m:e base + m:lim limit
converters/index.ts Export both converters
omml-to-mathml.ts Import + register in MATH_OBJECT_REGISTRY
omml-to-mathml.test.ts 10 new tests (5 per converter)

Test plan

…, SD-2378)

Add lower limit (m:limLow → <munder>) and upper limit (m:limUpp → <mover>)
OMML-to-MathML converters per ECMA-376 §22.1.2.54 and §22.1.2.56.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gpardhivvarma
Copy link
Copy Markdown
Contributor Author

@caio-pizzol pls take a look

gpardhivvarma and others added 4 commits April 13, 2026 01:58
Remove duplicate m:rad test block that was cleaned up upstream.
Preserve m:limLow and m:limUpp test suites.
ECMA-376 §22.1.2 defines m:sty (style: p/b/i/bi) and m:scr (script: roman,
script, fraktur, double-struck, sans-serif, monospace) on math run
properties. Word emits m:sty="p" on function names like "lim", "max",
"sup" — without this handling those names rendered italic instead of
upright when they appear outside an m:func wrapper.

Precedence: m:sty > m:scr > m:nor. m:nor stays as the legacy normal
flag, equivalent to m:sty="p" when no explicit style or script is set.
- Tighten "handles missing m:e/m:lim gracefully" tests: assert arity-2
  <munder>/<mover> with an empty <mrow> on the missing side (was only
  checking the present side).
- Add multi-run base tests for both converters — existing tests only
  exercised multi-run m:lim, leaving the m:e base-wrapping path
  untested.
- Add nested-math tests (fraction inside m:lim) for both converters.
- Add m:func-wrapped tests (m:func > m:fName > m:limLow/m:limUpp) —
  the shape Word actually emits when the base is a function keyword.
- Add full coverage for m:sty (p/b/i/bi), m:scr (6 variants), and
  m:sty > m:scr precedence per ECMA-376 §22.1.2.
…/2378)

New fixture math-limit-tests.docx contains 8 Word-native limit shapes:
m:limLow in m:func, bare m:limUpp, m:limLow with fraction in m:lim,
bare m:limLow, m:limUpp in m:func, multi-char non-lim function bases
(max, sup), and m:limLow with a nested m:sSub in the limit expression.

Seven new it blocks assert:
- arity of <munder> (6) and <mover> (2)
- nested <mfrac> inside <munder> (case 3)
- nested <msub> inside <munder> (case 8)
- mathvariant=normal on function keywords via m:sty val=p
- bare identifiers keep italic default (no stray mathvariant)
- property elements (m:limLowPr/m:limUppPr/m:ctrlPr) don't leak to DOM

The same fixture is uploaded to the shared R2 corpus as
sd-2377-limlow-limupp-showcase-all-cases.docx so test:layout and
test:visual cover these shapes automatically.
@caio-pizzol
Copy link
Copy Markdown
Contributor

@gpardhivvarma nice work! pushed a few commits to tighten things up.

added handling for two word-specific markers that make function names like "lim", "max", "sup" render upright instead of italic — word puts these on by default but we weren't reading them.

also beefed up the tests: tightened the "missing input" cases, added tests for bases with multiple parts, nested math inside the limit, and the wrapping word uses in real documents. dropped in a fixture with 8 real word equations + uploaded them to the test corpus so layout and visual regressions pick them up.

two things out of scope i'll open separate tickets for: variables inside wrapped limits come out upright when they should be italic, and multi-letter operator names end up as identifiers. both live elsewhere.

verified in the dev app. good to merge once CI is green.

@caio-pizzol caio-pizzol enabled auto-merge April 12, 2026 21:23
@caio-pizzol caio-pizzol self-assigned this Apr 12, 2026
@caio-pizzol caio-pizzol added this pull request to the merge queue Apr 12, 2026
Merged via the queue into superdoc-dev:main with commit 9a3776d Apr 12, 2026
50 checks passed
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.2

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

🎉 This PR is included in template-builder v1.5.0-next.5

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.5

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

🎉 This PR is included in esign v2.3.0-next.5

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

🎉 This PR is included in superdoc-cli v0.7.0-next.5

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

🎉 This PR is included in superdoc v1.26.0-next.5

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 12, 2026

🎉 This PR is included in superdoc-sdk v1.6.0-next.2

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.

Math: implement m:limUpp upper limit converter (community) Math: implement m:limLow lower limit converter (community)

3 participants