1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- "use strict";
- var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- var BaseMethods_js_1 = __importDefault(require("../base/BaseMethods.js"));
- var MmlNode_js_1 = require("../../../core/MmlTree/MmlNode.js");
- var TexError_js_1 = __importDefault(require("../TexError.js"));
- var BraketMethods = {};
- BraketMethods.Macro = BaseMethods_js_1.default.Macro;
- BraketMethods.Braket = function (parser, _name, open, close, stretchy, barmax) {
- var next = parser.GetNext();
- if (next === '') {
- throw new TexError_js_1.default('MissingArgFor', 'Missing argument for %1', parser.currentCS);
- }
- var single = true;
- if (next === '{') {
- parser.i++;
- single = false;
- }
- parser.Push(parser.itemFactory.create('braket')
- .setProperties({ barmax: barmax, barcount: 0, open: open,
- close: close, stretchy: stretchy, single: single }));
- };
- BraketMethods.Bar = function (parser, name) {
- var c = name === '|' ? '|' : '\u2225';
- var top = parser.stack.Top();
- if (top.kind !== 'braket' ||
- top.getProperty('barcount') >= top.getProperty('barmax')) {
- var mml = parser.create('token', 'mo', { texClass: MmlNode_js_1.TEXCLASS.ORD, stretchy: false }, c);
- parser.Push(mml);
- return;
- }
- if (c === '|' && parser.GetNext() === '|') {
- parser.i++;
- c = '\u2225';
- }
- var stretchy = top.getProperty('stretchy');
- if (!stretchy) {
- var node_1 = parser.create('token', 'mo', { stretchy: false, braketbar: true }, c);
- parser.Push(node_1);
- return;
- }
- var node = parser.create('node', 'TeXAtom', [], { texClass: MmlNode_js_1.TEXCLASS.CLOSE });
- parser.Push(node);
- top.setProperty('barcount', top.getProperty('barcount') + 1);
- node = parser.create('token', 'mo', { stretchy: true, braketbar: true }, c);
- parser.Push(node);
- node = parser.create('node', 'TeXAtom', [], { texClass: MmlNode_js_1.TEXCLASS.OPEN });
- parser.Push(node);
- };
- exports.default = BraketMethods;
- //# sourceMappingURL=BraketMethods.js.map
|