mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
Make |, \lvert, \rvert work
Test Plan: . Reviewers: xymostech Reviewed By: xymostech Differential Revision: http://phabricator.benalpert.com/D33
This commit is contained in:
@@ -30,7 +30,7 @@ var MJLite = (function() {
|
|||||||
var className = "mbin";
|
var className = "mbin";
|
||||||
if (prev == null || prev.type === "bin" || prev.type === "open") {
|
if (prev == null || prev.type === "bin" || prev.type === "open") {
|
||||||
group.type = "ord";
|
group.type = "ord";
|
||||||
elem.className = "mord";
|
className = "mord";
|
||||||
}
|
}
|
||||||
return makeSpan(className, textit(group.value));
|
return makeSpan(className, textit(group.value));
|
||||||
} else if (group.type === "sup") {
|
} else if (group.type === "sup") {
|
||||||
@@ -64,7 +64,9 @@ var MJLite = (function() {
|
|||||||
var charLookup = {
|
var charLookup = {
|
||||||
'*': '\u2217',
|
'*': '\u2217',
|
||||||
'-': '\u2212',
|
'-': '\u2212',
|
||||||
'cdot': '\u22C5'
|
'cdot': '\u22C5',
|
||||||
|
'lvert': '|',
|
||||||
|
'rvert': '|'
|
||||||
};
|
};
|
||||||
|
|
||||||
var textit = function(value) {
|
var textit = function(value) {
|
||||||
|
@@ -7,7 +7,9 @@
|
|||||||
\s+ /* skip whitespace */
|
\s+ /* skip whitespace */
|
||||||
cdot return 'CDOT'
|
cdot return 'CDOT'
|
||||||
frac return 'FRAC'
|
frac return 'FRAC'
|
||||||
[/a-zA-Z0-9] return 'ORD'
|
lvert return 'LVERT'
|
||||||
|
rvert return 'RVERT'
|
||||||
|
[/|a-zA-Z0-9] return 'ORD'
|
||||||
[*+-] return 'BIN'
|
[*+-] return 'BIN'
|
||||||
\^ return '^'
|
\^ return '^'
|
||||||
[_] return '_'
|
[_] return '_'
|
||||||
@@ -66,6 +68,10 @@ func
|
|||||||
{$$ = [{type: 'bin', value: yytext}];}
|
{$$ = [{type: 'bin', value: yytext}];}
|
||||||
| 'FRAC' group group
|
| 'FRAC' group group
|
||||||
{$$ = [{type: 'frac', value: {numer: $2, denom: $3}}];}
|
{$$ = [{type: 'frac', value: {numer: $2, denom: $3}}];}
|
||||||
|
| 'LVERT'
|
||||||
|
{$$ = [{type: 'open', value: yytext}];}
|
||||||
|
| 'RVERT'
|
||||||
|
{$$ = [{type: 'close', value: yytext}];}
|
||||||
;
|
;
|
||||||
|
|
||||||
atom
|
atom
|
||||||
|
Reference in New Issue
Block a user