1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.BraketItem = void 0;
- var StackItem_js_1 = require("../StackItem.js");
- var MmlNode_js_1 = require("../../../core/MmlTree/MmlNode.js");
- var ParseUtil_js_1 = __importDefault(require("../ParseUtil.js"));
- var BraketItem = (function (_super) {
- __extends(BraketItem, _super);
- function BraketItem() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- Object.defineProperty(BraketItem.prototype, "kind", {
- get: function () {
- return 'braket';
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BraketItem.prototype, "isOpen", {
- get: function () {
- return true;
- },
- enumerable: false,
- configurable: true
- });
- BraketItem.prototype.checkItem = function (item) {
- if (item.isKind('close')) {
- return [[this.factory.create('mml', this.toMml())], true];
- }
- if (item.isKind('mml')) {
- this.Push(item.toMml());
- if (this.getProperty('single')) {
- return [[this.toMml()], true];
- }
- return StackItem_js_1.BaseItem.fail;
- }
- return _super.prototype.checkItem.call(this, item);
- };
- BraketItem.prototype.toMml = function () {
- var inner = _super.prototype.toMml.call(this);
- var open = this.getProperty('open');
- var close = this.getProperty('close');
- if (this.getProperty('stretchy')) {
- return ParseUtil_js_1.default.fenced(this.factory.configuration, open, inner, close);
- }
- var attrs = { fence: true, stretchy: false, symmetric: true, texClass: MmlNode_js_1.TEXCLASS.OPEN };
- var openNode = this.create('token', 'mo', attrs, open);
- attrs.texClass = MmlNode_js_1.TEXCLASS.CLOSE;
- var closeNode = this.create('token', 'mo', attrs, close);
- var mrow = this.create('node', 'mrow', [openNode, inner, closeNode], { open: open, close: close, texClass: MmlNode_js_1.TEXCLASS.INNER });
- return mrow;
- };
- return BraketItem;
- }(StackItem_js_1.BaseItem));
- exports.BraketItem = BraketItem;
- //# sourceMappingURL=BraketItems.js.map
|