Commit 9a3776d
feat(math): implement m:limLow and m:limUpp limit converters (#2771)
* feat(math): implement m:limLow and m:limUpp limit converters (SD-2377, 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>
* feat(math): handle m:sty and m:scr in convertMathRun (SD-2377/2378)
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.
* test(math): expand limLow/limUpp unit coverage (SD-2377/2378)
- 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.
* test(math): add behavior fixture and tests for limLow/limUpp (SD-2377/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.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Caio Pizzol <caiopizzol@icloud.com>1 parent 81ee173 commit 9a3776d
File tree
8 files changed
+937
-10
lines changed- packages/layout-engine/painters/dom/src/features/math
- converters
- tests/behavior/tests/importing
- fixtures
8 files changed
+937
-10
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
Lines changed: 45 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
80 | 118 | | |
81 | 119 | | |
82 | 120 | | |
| |||
105 | 143 | | |
106 | 144 | | |
107 | 145 | | |
108 | | - | |
109 | 146 | | |
110 | | - | |
111 | | - | |
| 147 | + | |
112 | 148 | | |
| 149 | + | |
113 | 150 | | |
114 | 151 | | |
115 | 152 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
120 | 158 | | |
121 | 159 | | |
122 | 160 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments