This is almost like the align* environment, but it starts out in math mode,
so we don't have to worry about the fact that we have no real surrounding
text mode in KaTeX. This is the first step towards align* and align.
Instead of passing around the current position as an argument, we now have a
parser property called pos to keep track of that. Instead of repeatedly
re-lexing at the current position we now have a property called nextToken
which contains the token beginning at the current position. We may need to
re-lex if we switch mode. Since the position is kept in the parser state,
we don't need to return it from parsing methods, which obsoletes the
ParseResult class.
This is an attempt to actually exercise all the code paths which can lead to
a ParserError exception (from malformed user input, without tinkering with
any KaTeX internals or exploiting a KaTeX bug). It documents the current
state of affairs, without changing any error messages. Comments indicate
future work, particularly with respect to the position often associated with
these error messages.
Instead of having our own copy of jasmine in the repository, we use
jasmine-core as an npm dependency and load it from there. That reduces the
size of the repository and helps keeping up to date. We're not using the
transitive dependency on jasmine-core via jasmine, since the jasmine package
might change its dependency any day (although unlikely).
The katex-spec.js shipped from the server now includes all
`test/*[Ss]pec.js` (as matched via glob) so that additional spec files can
be created and will automatically get included in the browser-side test
suite. The contrib specs are not included at this point.
Visit http://0.0.0.0:7936/test/test.html while running server.js to see this
in action and verify the lack of failures.
Jasmine supports node these days, so there is no longer a need to use a
separate (and unmaintained) package to provide such bindings.
Making the switch exposed several misuses of the `toMatch` assertion in the
existing specification. Most of them were converted to `toEqual`, since
`toMatch` is only for matching against regular expressions.
Now Travis can run the screenshotter in verification mode. The files in the
repository will be seen as the expected outcome, and if the actual result
differs from that, it might be attempted four more times before the test
case is actually deemed failed. A timeout between page load and screenshot
should allow any possible font issues to settle down.
Thanks to the docker service provided by Travis CI, we should be able to
download and use the Selenium docker images in order to run our
screenshotter and check whether all the screenshots match the images from
the repository.
Summary:
The ability to use pre-determined character widths will benefit alternative
layout engines such as gagern's canvas layout engine. I would also like to
experiment would using CSS transforms to absolutely position each glyph. This
diff adds a new make rule, make extended_metrics, which generates metrics that
also containing glyph widths.
Test Plan:
- run `make extended_metrics`
- verify that fontMetricsData.js contains entries with 5 numbers instead of 4
Reviewers: emily alpert