/************************************************************* * * Copyright (c) 2018 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Class for generating tags, references, etc. * * @author v.sorge@mathjax.org (Volker Sorge) */ import TexParser from './TexParser.js'; import {MmlNode} from '../../core/MmlTree/MmlNode.js'; import {EnvList} from './StackItem.js'; import ParseOptions from './ParseOptions.js'; import {OptionList} from '../../util/Options.js'; /** * Simple class for label objects. */ export class Label { /** * @constructor * @param {string=} tag The tag that's displayed. * @param {string=} id The id that serves as reference. */ constructor(public tag: string = '???', public id: string = '') {} } /** * A simple class for keeping track of tag information. */ export class TagInfo { /** * @constructor * @param {string} env The environment name (e.g., align). * @param {boolean} taggable Environment supports tags (e.g., align* does, but * split does not.) * @param {boolean} defaultTags Environment is tagged by default (e.g., align * is, but align* is not). * @param {string} tag The tag name (e.g., 1). * @param {string} tagId The unique id for that tag (e.g., mjx-eqn-1). * @param {string} tagFormat The formatted tag (e.g., "(1)"). * @param {boolean} noTag A no tagging command has been set (e.g., \notag, * \nonumber). * @param {string} labelId The label referring to the tag. */ constructor(readonly env: string = '', readonly taggable: boolean = false, readonly defaultTags: boolean = false, public tag: string = null, public tagId: string = '', public tagFormat: string = '', public noTag: boolean = false, public labelId: string = '') {} } export interface Tags { /** * The global configurations in which the parsing takes place. * @type {ParseOptions} */ configuration: ParseOptions; /** * IDs used in this equation. * @type {Object.} */ ids: {[key: string]: boolean}; /** * IDs used in previous equations. * @type {Object.} */ allIds: {[key: string]: boolean}; /** * Labels in the current equation. * @type {Object.