stuff
This commit is contained in:
parent
bc92231240
commit
b8225c639e
11904 changed files with 1472749 additions and 133 deletions
74
node_modules/mathjax-full/ts/input/tex/newcommand/NewcommandItems.ts
generated
vendored
Normal file
74
node_modules/mathjax-full/ts/input/tex/newcommand/NewcommandItems.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2022 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 Items for TeX parsing of new environments.
|
||||
*
|
||||
* @author v.sorge@mathjax.org (Volker Sorge)
|
||||
*/
|
||||
|
||||
|
||||
import TexError from '../TexError.js';
|
||||
import {CheckType, BaseItem, StackItem} from '../StackItem.js';
|
||||
|
||||
|
||||
/**
|
||||
* Opening Item dealing with definitions of new environments. It's pushed onto
|
||||
* the stack whenever a user defined environment is encountered and remains
|
||||
* until a corresponding \\end collapses the stack.
|
||||
*/
|
||||
export class BeginEnvItem extends BaseItem {
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public get kind() {
|
||||
return 'beginEnv';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
get isOpen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public checkItem(item: StackItem): CheckType {
|
||||
if (item.isKind('end')) {
|
||||
// @test Newenvironment Empty, Newenvironment Align
|
||||
if (item.getName() !== this.getName()) {
|
||||
// @test (missing) \newenvironment{env}{aa}{bb}\begin{env}cc\end{equation}
|
||||
throw new TexError('EnvBadEnd', '\\begin{%1} ended with \\end{%2}',
|
||||
this.getName(), item.getName());
|
||||
}
|
||||
return [[this.factory.create('mml', this.toMml())], true];
|
||||
}
|
||||
if (item.isKind('stop')) {
|
||||
// @test (missing) \newenvironment{env}{aa}{bb}\begin{env}cc
|
||||
throw new TexError('EnvMissingEnd', 'Missing \\end{%1}', this.getName());
|
||||
}
|
||||
// @test Newenvironment Empty, Newenvironment Align
|
||||
return super.checkItem(item);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue