Commit Graph

244 Commits

Author SHA1 Message Date
Emily Eisenberg
a831e94a51 Remove dependency on underscore
Summary:
Remove all uses of underscore. For the things we actually need, make a
"util" file and put them in there.

Test Plan:
Make sure the test still succeed, and that the main page still
works.

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D3043
2013-07-13 20:42:19 -07:00
Emily Eisenberg
0da85483c4 Remove Parser options usage
Summary: Now, have katex catch and print exceptions instead of the
parser

Auditors: alpert
2013-07-13 18:15:17 -07:00
Emily Eisenberg
20658a95b6 Add \ in front of functions in the parser
Auditors: alpert
2013-07-13 16:13:05 -07:00
Emily Eisenberg
38e2d600fd Allow some functions to have letters after them
Summary: Allow there to be letters immediately after \ , \;, \,, \:.

Test Plan: Run the tests

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D3031
2013-07-13 00:05:41 -07:00
Emily Eisenberg
5871d1756f Fix typo, so we actually test x_x_x
Auditors: alpert
2013-07-12 23:17:32 -07:00
Emily Eisenberg
4122fa2b99 Rewrite the parser
Summary:
Make our own parser that doesn't use jison, so that we can handle
funny TeX syntax, and to make it smaller.

Test Plan: Make sure the tests pass with the new parser.

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D3029
2013-07-12 23:16:30 -07:00
Emily Eisenberg
507a552ffd Add some basic testing using jasmine
Summary:
Make some tests that test the parser. So far, there are no DOM tests,
but maybe later.

Test Plan:
Run `make serve` and then visit `/test/test.html`. Make sure all the
tests pass.

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D2987
2013-07-11 18:32:44 -07:00
Emily Eisenberg
adb8b5d671 Rename everything to KaTeX
Summary: Rename all instances of mjlite -> katex

Test Plan: Run the local server, make sure things still work.

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D2977
2013-07-10 14:08:50 -07:00
Emily Eisenberg
c9c305d304 Un-combine ords
Auditors: alpert
2013-07-10 12:11:39 -07:00
Emily Eisenberg
a9d79e58c4 Split out backtick because it's special
Auditors: spicyj
2013-07-09 22:41:38 -07:00
Emily Eisenberg
d747063d42 Add some more symbols to appropriate categories
Auditors: spicyj
2013-07-09 22:33:09 -07:00
Emily Eisenberg
90dfae6924 Attempt to merge ords together
Summary:
Try not to waste spans by putting a bunch of numbers or letters
together into the same ord box. I don't think that this breaks any of the
current stuff.

Test Plan:
Write lots of expressions that have ords in them. Make sure that all
the reasonable ords are grouped together, and that the formatting still works.

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D52
2013-07-09 22:31:19 -07:00
Emily Eisenberg
42cc8b1a12 Add ops
Summary: Add named functions like \sin, \cos, etc.

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D51
2013-07-09 22:04:33 -07:00
Emily Eisenberg
4a3ed8dce0 Remove accidental second arguments
Auditors: spicyj
2013-07-09 21:15:01 -07:00
Emily Eisenberg
a95b93789a Make {} turn things into ords
Auditors: spicyj
2013-07-09 21:14:04 -07:00
Emily Eisenberg
29fde5d364 Correctly style fracs as inners
Summary:
Turn fracs into inners like they should be, instead of using the
previous dumb hack.

Test Plan: Make sure \dfrac still works

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D50
2013-07-09 21:05:14 -07:00
Emily Eisenberg
a0eff74be3 Add punctuation
Summary: Add punctuation, like ",", ";", and "\colon"

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D49
2013-07-09 21:01:04 -07:00
Emily Eisenberg
66a43f551d Add llap and rlap
Summary:
By the powers of Greyskull (and maybe css) we have vanquished the
great and powerful llap! All hail!

Test Plan: Add some \llap and \rlap. Make sure it's positioned correctly.

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D48
2013-07-09 16:02:44 -07:00
Emily Eisenberg
b016015d4e Sync styles with khan-exercises
Summary:
Get the styles into a form that they can be directly copied over to
khan-exercises, with no changes. Mostly just changing #math to .mathmathmath
and adding a font style and size.

Test Plan: Make sure that the local test still works.

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D47
2013-07-09 15:53:35 -07:00
Emily Eisenberg
2478a385ae Add spacing functions
Summary: Add \qquad, \quad, \;, etc. Fixes T7

Test Plan:
Add some spacings. Make sure that they look reasonable widths.
Especially, if you add a space (`\space`), make sure that it doesn't disappear
because the spacing disappears.

Reviewers: spicyj

Reviewed By: spicyj

Maniphest Tasks: T7

Differential Revision: http://phabricator.benalpert.com/D46
2013-07-09 15:32:54 -07:00
Emily Eisenberg
a30a39247f Add a thin space around fractions
Auditors: spicyj
2013-07-09 15:31:09 -07:00
Emily Eisenberg
8d85aa464e Add rels
Summary: Add a bunch of rels, and their css and stuff.

Test Plan: Add some rels. Rejoice.

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D45
2013-07-09 00:57:03 -07:00
Emily Eisenberg
9d2ac2c132 Make the makefile better
Auditors: spicyj
2013-07-09 00:09:01 -07:00
Ben Alpert
d5c2a6fb38 Make things sort of work in IE8
Summary:
Uploaded the OTFs from eab3322d to fontsquirrel with the following config:

```
{"mode":"expert","formats":["ttf","woff","eotz"],"tt_instructor":"default","fix_vertical_metrics":"Y","fix_gasp":"xy","add_spaces":"Y","add_hyphens":"Y","fallback":"none","fallback_custom":"100","options_subset":"none","subset_custom":"","subset_custom_range":"","css_stylesheet":"stylesheet.css","filename_suffix":"","emsquare":"2048","spacing_adjustment":"0"}
```

Now we have this beauty in IE8:

{F213}

and it looks similar in Chrome. Now I guess we just need square roots so we can stop disseminating the wrong quadratic formula.

Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D43
2013-07-08 22:48:14 -07:00
Emily Eisenberg
2c067161df Add color support
Summary: Not true `\color`, but `\blue`, `\red`, etc.

Test Plan:
Add `\blue`, etc around stuff, see that it makes pretty colors
appear.

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D44
2013-07-08 15:48:56 -07:00
Emily Eisenberg
0d901b4da4 Make the lexer errors actually work
Auditors: spicyj
2013-07-08 15:37:26 -07:00
Emily Eisenberg
f97aad13b7 Make large fractions actually work
Summary:
Also, rename it to '\dfrac', because it's more like a display fraction

Auditors: spicyj
2013-07-07 22:43:16 -07:00
Ben Alpert
2643f72a9d Tweaks to lexer, incl. matching func all at once
Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D42
2013-07-07 21:27:08 -07:00
Emily Eisenberg
eab3322db3 Use our own local (awesome) fonts
Summary: Build or own fonts from MathJax's repo, and use those instead.

Test Plan: Use the new fonts, enjoy!

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D41
2013-07-07 21:20:22 -07:00
Emily Eisenberg
8f99433c80 Use our own lexer, not jison's
Summary:
Build our own lexer and inject it into jison's parser, because jison's
lexer notation is confusing and annoying, and it doesn't let us do some fun
stuff.

Test Plan: Run stuff, make sure it still works.

Reviewers: spicyj

Reviewed By: spicyj

Differential Revision: http://phabricator.benalpert.com/D40
2013-07-07 21:13:43 -07:00
Ben Alpert
33625f7b08 Catch server errors and return 500
Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D39
2013-07-07 14:13:25 -07:00
Emily Eisenberg
3caccbf933 Get rid of some forgotten elems
Auditors: alpert
2013-07-07 12:15:32 -07:00
Emily Eisenberg
00d775f420 Don't make undefined classNames
Auditors: spicyj
2013-07-06 00:52:25 -07:00
Ben Alpert
4bc599966f Create node server to replace 'make watch'
Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D38
2013-07-05 22:55:10 -07:00
Ben Alpert
afb29f5df3 Use browserify and "modules"
Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D37
2013-07-05 21:44:44 -07:00
Ben Alpert
97dc1bf1da Add \pm, \div
Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D36
2013-07-05 21:44:17 -07:00
Ben Alpert
29949b500a Make clearNode screaming-fast-er
Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D35
2013-07-05 21:24:39 -07:00
Ben Alpert
8f26740010 Add bin + open, close + bin spacing styles
Summary: Closes T2.

Reviewers: xymostech

Reviewed By: xymostech

Maniphest Tasks: T2

Differential Revision: http://phabricator.benalpert.com/D34
2013-07-05 21:24:26 -07:00
Ben Alpert
d436e09d07 Make |, \lvert, \rvert work
Test Plan: .

Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D33
2013-07-05 21:20:04 -07:00
Emily Eisenberg
96733c279c Use mathit less, so things are less italic
Auditors: alpert
2013-07-05 21:14:04 -07:00
Emily Eisenberg
37355b82d1 Make the makefile more helpful
Auditors: spicyj
2013-07-05 20:55:25 -07:00
Emily Eisenberg
d2fa50c836 Refactor most of the javascript
Summary: Move MJLite into its own file, make a module. Now includes underscore.

Test Plan: Make sure it still parses stuff.

Reviewers: spicyj

Reviewed By: spicyj

CC: divad12

Differential Revision: http://phabricator.benalpert.com/D32
2013-07-05 20:34:24 -07:00
Emily Eisenberg
506c0b389b Add an arcconfig 2013-07-05 16:43:44 -07:00
Emily Eisenberg
708a36502b Initial commit 2013-07-05 02:05:33 -07:00