Make |, \lvert, \rvert work

Test Plan: .

Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D33
This commit is contained in:
Ben Alpert 2013-07-05 21:20:04 -07:00
parent 96733c279c
commit d436e09d07
2 changed files with 11 additions and 3 deletions

View File

@ -30,7 +30,7 @@ var MJLite = (function() {
var className = "mbin";
if (prev == null || prev.type === "bin" || prev.type === "open") {
group.type = "ord";
elem.className = "mord";
className = "mord";
}
return makeSpan(className, textit(group.value));
} else if (group.type === "sup") {
@ -64,7 +64,9 @@ var MJLite = (function() {
var charLookup = {
'*': '\u2217',
'-': '\u2212',
'cdot': '\u22C5'
'cdot': '\u22C5',
'lvert': '|',
'rvert': '|'
};
var textit = function(value) {

View File

@ -7,7 +7,9 @@
\s+ /* skip whitespace */
cdot return 'CDOT'
frac return 'FRAC'
[/a-zA-Z0-9] return 'ORD'
lvert return 'LVERT'
rvert return 'RVERT'
[/|a-zA-Z0-9] return 'ORD'
[*+-] return 'BIN'
\^ return '^'
[_] return '_'
@ -66,6 +68,10 @@ func
{$$ = [{type: 'bin', value: yytext}];}
| 'FRAC' group group
{$$ = [{type: 'frac', value: {numer: $2, denom: $3}}];}
| 'LVERT'
{$$ = [{type: 'open', value: yytext}];}
| 'RVERT'
{$$ = [{type: 'close', value: yytext}];}
;
atom