Repository navigation
Conversation
Linux library size: 0.60 MiB (+0.00%)
Built with default features, Rust 1.96.0, and Ubuntu 24.04. Workflow run. |
|
The MathML grammar for so it is not legal MathML to end with an |
I read this as:
This matches the grammar in Relax NG: Regardless, it's not very useful. I don't expect to see it in real books. However, I also don't want MathCAT to crash should this notation ever show up. My suggestion is to clean up: <math><mmultiscripts><mi>a</mi><mi>b</mi><mi>c</mi><mprescripts/></mmultiscripts></math>into: <math><mmultiscripts><mi>a</mi><mi>b</mi><mi>c</mi></mmultiscripts></math> |
|
I just pushed a new solution on this branch. This is actually much better, thanks for pointing out the proper solution! What changed:
I believe that this covers all reasonable types of valid and invalid input, with some content improvements as well. One disclaimer: I was very much spot-welding instead of considering the entire codebase. So do keep pointing out better ways to do things, it makes for better solutions. A side thought while I was working on this: perhaps instead of catching many types of invalid MathML, MathCAT could validate against a schema? |
|
FYI: I filed a MathML issue: w3c/mathml#605 |
|
Thanks. I do agree that this particular notation is not useful. I don't think that it makes sense for a speech/braille notation to indicate that yes, there are prescripts, but then no, the list is actually empty. Therefore, this PR silently cleans up |
|
cleaning up the empty list seems like a good plan to me, despite the fact that we closed the referenced MathML issue with no change, confirming that the trailing |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
As a follow-up to the above, after some more reflection I would suggest that MathCAT also rejects <mmultiscripts>
<mi>x</mi> <!-- base -->
<mi>a</mi> <!-- unclear: is this sub or super? -->
<mprescripts/>
<mi>b</mi> <!-- unclear: is this sub or super? -->
</mmultiscripts>Currently, missing element(s) get added as Related: #1086 |
Fix two crashes with prescripts in
mmultiscripts:mmultiscriptswithmprescriptsas its last child crashed, because MathCAT assumed that at least one pair of presubscript and presuperscript follows. Although this is expected, the MathML grammar allows omitting them. We now check for that.3of a vector of length3.The above came to light when I ran various types of prescripts through MathCAT to verify the Dedicon notation for them (its rule that "space ends a subscript" meant that I ran some interesting examples to test edge cases).