Merge pull request #2 from asnunes/divider-fix

Divider fix
This commit is contained in:
Alexandre Nunes 2021-01-07 11:23:37 -03:00 committed by GitHub
commit 1e0e098095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 3 deletions

@ -1 +1 @@
nodejs 12.18.4
nodejs 14.15.3

@ -64,6 +64,14 @@ describe('#convert', () => {
expect(result).toMatch('+');
});
it('converts bar divider preserving it', () => {
const mathml = mathmlStrings.moDividerOperator;
const result = MathMLToLaTeX.convert(mathml);
expect(result).toMatch('x=4/5');
});
});
describe('with Glyph operator', () => {

@ -64,6 +64,18 @@ export const moWithSimpleOperator = `
</root>
`;
export const moDividerOperator = `
<math>
<mi>x</mi>
<mo>=</mo>
<mn>4</mn>
<mrow>
<mo>/</mo>
</mrow>
<mn>5</mn>
</math>
`;
export const moWithGlyphOperator = `
<root>
<math>

@ -1,3 +1,5 @@
import { MathMLToLaTeX } from './main';
export default MathMLToLaTeX;
module.exports = MathMLToLaTeX;

@ -76,7 +76,7 @@ export const allMathOperatorsByChar: Record<string, string> = {
'&#x2221;': '\\measuredangle',
'&#x2220;': '\\angle',
'&#xF7;': '\\div',
'/': '//',
'/': '/',
'&#x2216;': '\\backslash',
'\\': '\\backslash',
'%': '\\%',

@ -74,7 +74,7 @@ export const allMathOperatorsByGlyph: Record<string, string> = {
'∡': '\\measuredangle',
'∠': '\\angle',
'÷': '\\div',
'/': '//',
'/': '/',
'': '\\backslash',
'\\': '\\backslash',
'%': '\\%',