Rewrite spacing commands as macros (#1156)
* Rewrite spacing commands as macros Fix #1130 by defining `\!`, `\negthinspace`, `\,`, `\thinspace`, `\:`, `\medspace`, `\;`, `\thickspace`, `\negmedspace`, `\negthickspace`, `\enspace`, `\enskip`, `\qquad`, `\quad` as macros. Fix #1036 by defining a new `SpaceNode` in mathMLTree that recognizes all special space amounts from https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html * Fix <mspace> rendering and add a test to catch it * Update screenshots * Wrap special space characters in <mtext> * Update screenshots * Fix MathML escaping behavior * Fix flow typos * Fix Unicode-chrome * Reimplement mod operators in terms of macros * Rerun ModScript * Remove excess table entries (now already macros) * Fix bmod
@@ -57,6 +57,24 @@ exports[`A MathML builder accents turn into <mover accent="true"> in MathML 1`]
|
||||
|
||||
`;
|
||||
|
||||
exports[`A MathML builder normal spaces render normally 1`] = `
|
||||
|
||||
<math>
|
||||
<semantics>
|
||||
<mrow>
|
||||
<mspace width="1em">
|
||||
</mspace>
|
||||
<mspace width="0.431em">
|
||||
</mspace>
|
||||
</mrow>
|
||||
<annotation encoding="application/x-tex">
|
||||
\\kern1em\\kern1ex
|
||||
</annotation>
|
||||
</semantics>
|
||||
</math>
|
||||
|
||||
`;
|
||||
|
||||
exports[`A MathML builder should concatenate digits into single <mn> 1`] = `
|
||||
|
||||
<math>
|
||||
@@ -125,8 +143,9 @@ exports[`A MathML builder should generate the right types of nodes 1`] = `
|
||||
<mn>
|
||||
1
|
||||
</mn>
|
||||
<mspace width="0.277778em">
|
||||
</mspace>
|
||||
<mtext>
|
||||
  
|
||||
</mtext>
|
||||
<mtext>
|
||||
a
|
||||
</mtext>
|
||||
@@ -169,7 +188,7 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correc
|
||||
<msub>
|
||||
<mo>
|
||||
<mi mathvariant="normal">
|
||||
lim sup
|
||||
lim sup
|
||||
</mi>
|
||||
<mo>
|
||||
|
||||
@@ -204,7 +223,7 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in dis
|
||||
<munder>
|
||||
<mo>
|
||||
<mi mathvariant="normal">
|
||||
lim sup
|
||||
lim sup
|
||||
</mi>
|
||||
<mo>
|
||||
|
||||
@@ -519,6 +538,74 @@ exports[`A MathML builder should use <munderover> for large operators 1`] = `
|
||||
|
||||
`;
|
||||
|
||||
exports[`A MathML builder special spaces render specially 1`] = `
|
||||
|
||||
<math>
|
||||
<semantics>
|
||||
<mrow>
|
||||
<mtext>
|
||||
 
|
||||
</mtext>
|
||||
<mtext>
|
||||
 
|
||||
</mtext>
|
||||
<mtext>
|
||||
 
|
||||
</mtext>
|
||||
<mtext>
|
||||
 
|
||||
</mtext>
|
||||
<mtext>
|
||||
  
|
||||
</mtext>
|
||||
<mtext>
|
||||
  
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
<mtext>
|
||||
 
|
||||
</mtext>
|
||||
<mtext>
|
||||
 
|
||||
</mtext>
|
||||
<mtext>
|
||||
 
|
||||
</mtext>
|
||||
<mtext>
|
||||
  
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
<mtext>
|
||||
​
|
||||
</mtext>
|
||||
</mrow>
|
||||
<annotation encoding="application/x-tex">
|
||||
\\,\\thinspace\\:\\medspace\\;\\thickspace\\!\\negthinspace\\negmedspace\\negthickspace\\mkern1mu\\mkern3mu\\mkern4mu\\mkern5mu\\mkern-1mu\\mkern-3mu\\mkern-4mu\\mkern-5mu
|
||||
</annotation>
|
||||
</semantics>
|
||||
</math>
|
||||
|
||||
`;
|
||||
|
||||
exports[`A MathML builder tags use <mlabeledtr> 1`] = `
|
||||
|
||||
<math>
|
||||
|
@@ -107,4 +107,15 @@ describe("A MathML builder", function() {
|
||||
expect(getMathML("\\tag{hi} x+y^2", {displayMode: true}))
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('normal spaces render normally', function() {
|
||||
expect(getMathML("\\kern1em\\kern1ex")).toMatchSnapshot();
|
||||
});
|
||||
it('special spaces render specially', function() {
|
||||
expect(getMathML(
|
||||
"\\,\\thinspace\\:\\medspace\\;\\thickspace" +
|
||||
"\\!\\negthinspace\\negmedspace\\negthickspace" +
|
||||
"\\mkern1mu\\mkern3mu\\mkern4mu\\mkern5mu" +
|
||||
"\\mkern-1mu\\mkern-3mu\\mkern-4mu\\mkern-5mu")).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |