Adds MathML support for math font commands.

This is part 3 or 3.  The first two pull requests added font metrics, HTML rendering, and screenshot tests.
This commit is contained in:
Kevin Barabash
2015-07-04 15:32:31 -06:00
committed by Kevin Barabash
parent 1b5834d894
commit 64e63d7546
6 changed files with 295 additions and 74 deletions

View File

@@ -1,15 +1,30 @@
var buildHTML = require("./buildHTML");
var buildMathML = require("./buildMathML");
var buildCommon = require("./buildCommon");
var Options = require("./Options");
var Settings = require("./Settings");
var Style = require("./Style");
var makeSpan = buildCommon.makeSpan;
var buildTree = function(tree, expression, settings) {
settings = settings || new Settings({});
var startStyle = Style.TEXT;
if (settings.displayMode) {
startStyle = Style.DISPLAY;
}
// Setup the default options
var options = new Options({
style: startStyle,
size: "size5"
});
// `buildHTML` sometimes messes with the parse tree (like turning bins ->
// ords), so we build the MathML version first.
var mathMLNode = buildMathML(tree, expression, settings);
var htmlNode = buildHTML(tree, settings);
var mathMLNode = buildMathML(tree, expression, options);
var htmlNode = buildHTML(tree, options);
var katexNode = makeSpan(["katex"], [
mathMLNode, htmlNode