New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve MathML for \not #1923
Improve MathML for \not #1923
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1923 +/- ##
==========================================
+ Coverage 94.82% 94.84% +0.01%
==========================================
Files 79 79
Lines 4776 4788 +12
Branches 842 847 +5
==========================================
+ Hits 4529 4541 +12
Misses 223 223
Partials 24 24
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1923 +/- ##
==========================================
+ Coverage 94.82% 94.83% +<.01%
==========================================
Files 79 79
Lines 4776 4783 +7
Branches 842 845 +3
==========================================
+ Hits 4529 4536 +7
Misses 223 223
Partials 24 24
Continue to review full report at Codecov.
|
src/buildMathML.js
Outdated
@@ -151,7 +151,29 @@ export const buildExpression = function( | |||
lastGroup = group; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can combine with the loop above, looping only once with the same or less number of checks:
// Combine \not with mrels and mords
/*L#148*/ } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
const lastChild = lastGroup.children[0];
if (lastChild instanceof TextNode && lastChild.text === '\u0338' &&
(group.type === 'mo' || group.type === 'mi' || group.type === 'mn')) {
const child = group.children[0];
if (child instanceof TextNode && child.text.length > 0) {
// Overlay with combining character long solidus
child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1);
groups.pop();
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This PR resolves a long-standing TODO item by implementing
\not
in MathML. The code employed is similar to the code used for HTML\not
prior to PR #1497.