Comparing version 0.13.13 to 0.13.14
# Changelog | ||
All notable changes to this project will be documented in this file. This CHANGELOG roughly follows the guidelines from [www.keepachangelog.com](https://keepachangelog.com/en/1.0.0/). | ||
## [0.13.14](https://github.com/KaTeX/KaTeX/compare/v0.13.13...v0.13.14) (2021-08-28) | ||
### Bug Fixes | ||
* **fonts:** update fonts dependencies ([#2866](https://github.com/KaTeX/KaTeX/issues/2866)) ([ea409ea](https://github.com/KaTeX/KaTeX/commit/ea409eaf1d7f8fe712a966edc66c545ae5fe5425)) | ||
## [0.13.13](https://github.com/KaTeX/KaTeX/compare/v0.13.12...v0.13.13) (2021-07-21) | ||
@@ -5,0 +12,0 @@ |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import splitAtDelimiters from "../splitAtDelimiters"; | ||
@@ -2,0 +5,0 @@ import renderMathInElement from "../auto-render"; |
@@ -24,4 +24,4 @@ # Copy-tex extension | ||
```html | ||
<link href="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script> | ||
<link href="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script> | ||
``` | ||
@@ -41,3 +41,3 @@ | ||
```html | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script> | ||
``` | ||
@@ -44,0 +44,0 @@ |
@@ -14,3 +14,3 @@ # `math/tex` Custom Script Type Extension | ||
```html | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/mathtex-script-type.min.js" integrity="sha384-lfASb0Jhxn21qr4pih+Mx6uK2+JEKTtnpMnsCo+PTmb3n/iSUhox6v7eGkBfi47O" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/mathtex-script-type.min.js" integrity="sha384-lfASb0Jhxn21qr4pih+Mx6uK2+JEKTtnpMnsCo+PTmb3n/iSUhox6v7eGkBfi47O" crossorigin="anonymous"></script> | ||
``` | ||
@@ -27,5 +27,5 @@ You can download the script and use it locally, or from a local KaTeX installation instead. | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.css" integrity="sha384-RZU/ijkSsFbcmivfdRBQDtwuwVqK7GMOw6IMvKyeWL2K5UAlyp6WonmB8m7Jd0Hn" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.js" integrity="sha384-pK1WpvzWVBQiP0/GjnvRxV4mOb0oxFuyRxJlk6vVw146n3egcN5C925NCP7a7BY8" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/mathtex-script-type.min.js" integrity="sha384-lfASb0Jhxn21qr4pih+Mx6uK2+JEKTtnpMnsCo+PTmb3n/iSUhox6v7eGkBfi47O" crossorigin="anonymous"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/katex.min.css" integrity="sha384-olCGZRyRuwqK7wUf99rH5baew52IfIXvG6tE1vC0WSCGyC8xoxN+mQdGm6Xa3EEy" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/katex.min.js" integrity="sha384-rIL/+2u0s1C9mGY06v6oUFDSywqCk4P4hPV+5oIJ45eVj4JdqjNedesyl+6MOEXo" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/mathtex-script-type.min.js" integrity="sha384-lfASb0Jhxn21qr4pih+Mx6uK2+JEKTtnpMnsCo+PTmb3n/iSUhox6v7eGkBfi47O" crossorigin="anonymous"></script> | ||
</head> | ||
@@ -40,2 +40,2 @@ <body> | ||
```html | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script> |
@@ -10,3 +10,3 @@ # mhchem extension | ||
```html | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/mhchem.min.js" integrity="sha384-LIgAiYlGSAdpNC9+YDjDPF6JeS/RRIumtNo0CmyQERZ/+g0h9MbuYQwf/5pQ4Y4M" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/mhchem.min.js" integrity="sha384-LIgAiYlGSAdpNC9+YDjDPF6JeS/RRIumtNo0CmyQERZ/+g0h9MbuYQwf/5pQ4Y4M" crossorigin="anonymous"></script> | ||
``` | ||
@@ -13,0 +13,0 @@ |
@@ -10,2 +10,3 @@ # [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/) | ||
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/KaTeX/KaTeX) | ||
[![Financial Contributors on Open Collective](https://opencollective.com/katex/all/badge.svg?label=financial+contributors)](https://opencollective.com/katex) | ||
@@ -34,9 +35,9 @@ KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.css" integrity="sha384-RZU/ijkSsFbcmivfdRBQDtwuwVqK7GMOw6IMvKyeWL2K5UAlyp6WonmB8m7Jd0Hn" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/katex.min.css" integrity="sha384-olCGZRyRuwqK7wUf99rH5baew52IfIXvG6tE1vC0WSCGyC8xoxN+mQdGm6Xa3EEy" crossorigin="anonymous"> | ||
<!-- The loading of KaTeX is deferred to speed up page rendering --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.js" integrity="sha384-pK1WpvzWVBQiP0/GjnvRxV4mOb0oxFuyRxJlk6vVw146n3egcN5C925NCP7a7BY8" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/katex.min.js" integrity="sha384-rIL/+2u0s1C9mGY06v6oUFDSywqCk4P4hPV+5oIJ45eVj4JdqjNedesyl+6MOEXo" crossorigin="anonymous"></script> | ||
<!-- To automatically render math in text elements, include the auto-render extension: --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous" | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous" | ||
onload="renderMathInElement(document.body);"></script> | ||
@@ -88,8 +89,34 @@ </head> | ||
## Contributing | ||
## Contributors | ||
See [CONTRIBUTING.md](CONTRIBUTING.md) | ||
### Code Contributors | ||
This project exists thanks to all the people who contribute code. If you'd like to help, see [our guide to contributing code](CONTRIBUTING.md). | ||
<a href="https://github.com/KaTeX/KaTeX/graphs/contributors"><img src="https://contributors-svg.opencollective.com/katex/contributors.svg?width=890&button=false" alt="Code contributors" /></a> | ||
### Financial Contributors | ||
Become a financial contributor and help us sustain our community. | ||
#### Individuals | ||
<a href="https://opencollective.com/katex"><img src="https://opencollective.com/katex/individuals.svg?width=890" alt="Contribute on Open Collective"></a> | ||
#### Organizations | ||
Support this project with your organization. Your logo will show up here with a link to your website. | ||
<a href="https://opencollective.com/katex/organization/0/website"><img src="https://opencollective.com/katex/organization/0/avatar.svg" alt="Organization 1"></a> | ||
<a href="https://opencollective.com/katex/organization/1/website"><img src="https://opencollective.com/katex/organization/1/avatar.svg" alt="Organization 2"></a> | ||
<a href="https://opencollective.com/katex/organization/2/website"><img src="https://opencollective.com/katex/organization/2/avatar.svg" alt="Organization 3"></a> | ||
<a href="https://opencollective.com/katex/organization/3/website"><img src="https://opencollective.com/katex/organization/3/avatar.svg" alt="Organization 4"></a> | ||
<a href="https://opencollective.com/katex/organization/4/website"><img src="https://opencollective.com/katex/organization/4/avatar.svg" alt="Organization 5"></a> | ||
<a href="https://opencollective.com/katex/organization/5/website"><img src="https://opencollective.com/katex/organization/5/avatar.svg" alt="Organization 6"></a> | ||
<a href="https://opencollective.com/katex/organization/6/website"><img src="https://opencollective.com/katex/organization/6/avatar.svg" alt="Organization 7"></a> | ||
<a href="https://opencollective.com/katex/organization/7/website"><img src="https://opencollective.com/katex/organization/7/avatar.svg" alt="Organization 8"></a> | ||
<a href="https://opencollective.com/katex/organization/8/website"><img src="https://opencollective.com/katex/organization/8/avatar.svg" alt="Organization 9"></a> | ||
<a href="https://opencollective.com/katex/organization/9/website"><img src="https://opencollective.com/katex/organization/9/avatar.svg" alt="Organization 10"></a> | ||
## License | ||
KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT). |
@@ -31,3 +31,3 @@ // @flow | ||
import {defineSymbol} from './src/symbols'; | ||
import {defineMacro} from './src/macros'; | ||
import defineMacro from './src/defineMacro'; | ||
import {setFontMetrics} from './src/fontMetrics'; | ||
@@ -34,0 +34,0 @@ |
{ | ||
"name": "katex", | ||
"version": "0.13.13", | ||
"version": "0.13.14", | ||
"description": "Fast math typesetting for the web.", | ||
@@ -19,4 +19,6 @@ "main": "dist/katex.js", | ||
"license": "MIT", | ||
"packageManager": "yarn@3.0.1", | ||
"devDependencies": { | ||
"@babel/core": "^7.10.4", | ||
"@babel/eslint-parser": "^7.15.0", | ||
"@babel/plugin-proposal-class-properties": "^7.10.4", | ||
@@ -26,2 +28,3 @@ "@babel/plugin-transform-runtime": "^7.10.4", | ||
"@babel/preset-flow": "^7.10.4", | ||
"@babel/preset-react": "^7.14.5", | ||
"@babel/register": "^7.10.4", | ||
@@ -33,4 +36,3 @@ "@babel/runtime": "^7.10.4", | ||
"@semantic-release/git": "^9.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^26.1.0", | ||
"babel-jest": "^27.0.0", | ||
"babel-loader": "^8.0.5", | ||
@@ -44,3 +46,3 @@ "babel-plugin-istanbul": "^6.0.0", | ||
"caniuse-lite": "^1.0.30001102", | ||
"css-loader": "^5.1.2", | ||
"css-loader": "^6.0.0", | ||
"cssnano": "^5.0.0-rc.1", | ||
@@ -51,3 +53,2 @@ "eslint": "^7.4.0", | ||
"eslint-plugin-react": "^7.20.3", | ||
"file-loader": "^6.0.0", | ||
"flow-bin": "^0.135.0", | ||
@@ -60,6 +61,6 @@ "fs-extra": "^10.0.0", | ||
"istanbul-reports": "^3.0.2", | ||
"jest": "^26.1.0", | ||
"jest-diff": "^26.1.0", | ||
"jest-matcher-utils": "^26.1.0", | ||
"jest-message-util": "^26.1.0", | ||
"jest": "^27.0.0", | ||
"jest-diff": "^27.0.0", | ||
"jest-matcher-utils": "^27.0.0", | ||
"jest-message-util": "^27.0.0", | ||
"jest-serializer-html": "^7.0.0", | ||
@@ -70,8 +71,9 @@ "js-yaml": "^4.0.0", | ||
"less": "^4.0.0", | ||
"less-loader": "^9.0.0", | ||
"mini-css-extract-plugin": "^1.0.0", | ||
"less-loader": "^10.0.0", | ||
"mini-css-extract-plugin": "^2.0.0", | ||
"mkdirp": "^1.0.4", | ||
"p-retry": "^4.6.1", | ||
"pako": "^2.0.0", | ||
"postcss": "^8.0.0", | ||
"postcss-loader": "^5.2.0", | ||
"postcss-loader": "^6.0.0", | ||
"postcss-preset-env": "^6.7.0", | ||
@@ -82,13 +84,13 @@ "prettier": "^2.0.5", | ||
"rollup": "^2.21.0", | ||
"selenium-webdriver": "^3.6.0", | ||
"selenium-webdriver": "^4.0.0-beta.4", | ||
"semantic-release": "^17.4.1", | ||
"sri-toolbox": "^0.2.0", | ||
"style-loader": "^2.0.0", | ||
"style-loader": "^3.0.0", | ||
"stylelint": "^13.6.1", | ||
"stylelint-config-standard": "^22.0.0", | ||
"terser-webpack-plugin": "^5.0.3", | ||
"webpack": "^5.8.0", | ||
"webpack": "^5.51.1", | ||
"webpack-bundle-analyzer": "^4.0.0", | ||
"webpack-cli": "^4.2.0", | ||
"webpack-dev-server": "^4.0.0-beta.0" | ||
"webpack-cli": "^4.8.0", | ||
"webpack-dev-server": "^4.0.0" | ||
}, | ||
@@ -113,3 +115,5 @@ "bin": "cli.js", | ||
"analyze": "webpack --config webpack.analyze.js", | ||
"build": "rimraf dist/ && mkdirp dist && cp README.md dist && rollup -c && webpack && node update-sri.js package dist/README.md", | ||
"build": "rimraf dist/ && mkdirp dist && cp README.md dist && rollup -c --failAfterWarnings && webpack && node update-sri.js package dist/README.md", | ||
"build:fonts": "dockers/fonts/buildFonts.sh", | ||
"build:metrics": "dockers/fonts/buildMetrics.sh", | ||
"watch": "yarn build --watch", | ||
@@ -116,0 +120,0 @@ "postversion": "yarn dist && node update-sri.js package README.md contrib/*/README.md docs/*.md website/pages/index.html", |
@@ -10,2 +10,3 @@ # [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/) | ||
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/KaTeX/KaTeX) | ||
[![Financial Contributors on Open Collective](https://opencollective.com/katex/all/badge.svg?label=financial+contributors)](https://opencollective.com/katex) | ||
@@ -34,9 +35,9 @@ KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.css" integrity="sha384-RZU/ijkSsFbcmivfdRBQDtwuwVqK7GMOw6IMvKyeWL2K5UAlyp6WonmB8m7Jd0Hn" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/katex.min.css" integrity="sha384-olCGZRyRuwqK7wUf99rH5baew52IfIXvG6tE1vC0WSCGyC8xoxN+mQdGm6Xa3EEy" crossorigin="anonymous"> | ||
<!-- The loading of KaTeX is deferred to speed up page rendering --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.js" integrity="sha384-pK1WpvzWVBQiP0/GjnvRxV4mOb0oxFuyRxJlk6vVw146n3egcN5C925NCP7a7BY8" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/katex.min.js" integrity="sha384-rIL/+2u0s1C9mGY06v6oUFDSywqCk4P4hPV+5oIJ45eVj4JdqjNedesyl+6MOEXo" crossorigin="anonymous"></script> | ||
<!-- To automatically render math in text elements, include the auto-render extension: --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous" | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.14/dist/contrib/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous" | ||
onload="renderMathInElement(document.body);"></script> | ||
@@ -88,8 +89,34 @@ </head> | ||
## Contributing | ||
## Contributors | ||
See [CONTRIBUTING.md](CONTRIBUTING.md) | ||
### Code Contributors | ||
This project exists thanks to all the people who contribute code. If you'd like to help, see [our guide to contributing code](CONTRIBUTING.md). | ||
<a href="https://github.com/KaTeX/KaTeX/graphs/contributors"><img src="https://contributors-svg.opencollective.com/katex/contributors.svg?width=890&button=false" alt="Code contributors" /></a> | ||
### Financial Contributors | ||
Become a financial contributor and help us sustain our community. | ||
#### Individuals | ||
<a href="https://opencollective.com/katex"><img src="https://opencollective.com/katex/individuals.svg?width=890" alt="Contribute on Open Collective"></a> | ||
#### Organizations | ||
Support this project with your organization. Your logo will show up here with a link to your website. | ||
<a href="https://opencollective.com/katex/organization/0/website"><img src="https://opencollective.com/katex/organization/0/avatar.svg" alt="Organization 1"></a> | ||
<a href="https://opencollective.com/katex/organization/1/website"><img src="https://opencollective.com/katex/organization/1/avatar.svg" alt="Organization 2"></a> | ||
<a href="https://opencollective.com/katex/organization/2/website"><img src="https://opencollective.com/katex/organization/2/avatar.svg" alt="Organization 3"></a> | ||
<a href="https://opencollective.com/katex/organization/3/website"><img src="https://opencollective.com/katex/organization/3/avatar.svg" alt="Organization 4"></a> | ||
<a href="https://opencollective.com/katex/organization/4/website"><img src="https://opencollective.com/katex/organization/4/avatar.svg" alt="Organization 5"></a> | ||
<a href="https://opencollective.com/katex/organization/5/website"><img src="https://opencollective.com/katex/organization/5/avatar.svg" alt="Organization 6"></a> | ||
<a href="https://opencollective.com/katex/organization/6/website"><img src="https://opencollective.com/katex/organization/6/avatar.svg" alt="Organization 7"></a> | ||
<a href="https://opencollective.com/katex/organization/7/website"><img src="https://opencollective.com/katex/organization/7/avatar.svg" alt="Organization 8"></a> | ||
<a href="https://opencollective.com/katex/organization/8/website"><img src="https://opencollective.com/katex/organization/8/avatar.svg" alt="Organization 9"></a> | ||
<a href="https://opencollective.com/katex/organization/9/website"><img src="https://opencollective.com/katex/organization/9/avatar.svg" alt="Organization 10"></a> | ||
## License | ||
KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT). |
// @flow | ||
import defineFunction, {ordargument} from "../defineFunction"; | ||
import {defineMacro} from "../macros"; | ||
import defineMacro from "../defineMacro"; | ||
import buildCommon from "../buildCommon"; | ||
@@ -5,0 +5,0 @@ import mathMLTree from "../mathMLTree"; |
@@ -14,6 +14,6 @@ // @flow | ||
import Namespace from "./Namespace"; | ||
import builtinMacros from "./macros"; | ||
import macros from "./macros"; | ||
import type {MacroContextInterface, MacroDefinition, MacroExpansion, MacroArg} | ||
from "./macros"; | ||
from "./defineMacro"; | ||
import type Settings from "./Settings"; | ||
@@ -44,3 +44,3 @@ | ||
// Make new global namespace | ||
this.macros = new Namespace(builtinMacros, settings.macros); | ||
this.macros = new Namespace(macros, settings.macros); | ||
this.mode = mode; | ||
@@ -47,0 +47,0 @@ this.stack = []; // contains tokens in REVERSE order |
@@ -7,2 +7,7 @@ // @flow | ||
// Export global macros object from defineMacro | ||
import defineMacro, {_macros} from "./defineMacro"; | ||
const macros = _macros; | ||
export default macros; | ||
import fontMetricsData from "./fontMetricsData"; | ||
@@ -12,117 +17,5 @@ import functions from "./functions"; | ||
import utils from "./utils"; | ||
import {Token} from "./Token"; | ||
import ParseError from "./ParseError"; | ||
import type Namespace from "./Namespace"; | ||
import type {Mode} from "./types"; | ||
/** | ||
* Provides context to macros defined by functions. Implemented by | ||
* MacroExpander. | ||
*/ | ||
export interface MacroContextInterface { | ||
mode: Mode; | ||
/** | ||
* Object mapping macros to their expansions. | ||
*/ | ||
macros: Namespace<MacroDefinition>; | ||
/** | ||
* Returns the topmost token on the stack, without expanding it. | ||
* Similar in behavior to TeX's `\futurelet`. | ||
*/ | ||
future(): Token; | ||
/** | ||
* Remove and return the next unexpanded token. | ||
*/ | ||
popToken(): Token; | ||
/** | ||
* Consume all following space tokens, without expansion. | ||
*/ | ||
consumeSpaces(): void; | ||
/** | ||
* Expand the next token only once if possible. | ||
*/ | ||
expandOnce(expandableOnly?: boolean): Token | Token[]; | ||
/** | ||
* Expand the next token only once (if possible), and return the resulting | ||
* top token on the stack (without removing anything from the stack). | ||
* Similar in behavior to TeX's `\expandafter\futurelet`. | ||
*/ | ||
expandAfterFuture(): Token; | ||
/** | ||
* Recursively expand first token, then return first non-expandable token. | ||
*/ | ||
expandNextToken(): Token; | ||
/** | ||
* Fully expand the given macro name and return the resulting list of | ||
* tokens, or return `undefined` if no such macro is defined. | ||
*/ | ||
expandMacro(name: string): Token[] | void; | ||
/** | ||
* Fully expand the given macro name and return the result as a string, | ||
* or return `undefined` if no such macro is defined. | ||
*/ | ||
expandMacroAsText(name: string): string | void; | ||
/** | ||
* Consume an argument from the token stream, and return the resulting array | ||
* of tokens and start/end token. | ||
*/ | ||
consumeArg(delims?: ?string[]): MacroArg; | ||
/** | ||
* Consume the specified number of arguments from the token stream, | ||
* and return the resulting array of arguments. | ||
*/ | ||
consumeArgs(numArgs: number): Token[][]; | ||
/** | ||
* Determine whether a command is currently "defined" (has some | ||
* functionality), meaning that it's a macro (in the current group), | ||
* a function, a symbol, or one of the special commands listed in | ||
* `implicitCommands`. | ||
*/ | ||
isDefined(name: string): boolean; | ||
/** | ||
* Determine whether a command is expandable. | ||
*/ | ||
isExpandable(name: string): boolean; | ||
} | ||
export type MacroArg = { | ||
tokens: Token[], | ||
start: Token, | ||
end: Token | ||
}; | ||
/** Macro tokens (in reverse order). */ | ||
export type MacroExpansion = { | ||
tokens: Token[], | ||
numArgs: number, | ||
delimiters?: string[][], | ||
unexpandable?: boolean, // used in \let | ||
}; | ||
export type MacroDefinition = string | MacroExpansion | | ||
(MacroContextInterface => (string | MacroExpansion)); | ||
export type MacroMap = {[string]: MacroDefinition}; | ||
const builtinMacros: MacroMap = {}; | ||
export default builtinMacros; | ||
// This function might one day accept an additional argument and do more things. | ||
export function defineMacro(name: string, body: MacroDefinition) { | ||
builtinMacros[name] = body; | ||
} | ||
////////////////////////////////////////////////////////////////////// | ||
@@ -129,0 +22,0 @@ // macro tools |
@@ -20,5 +20,5 @@ ### How to generate new metrics | ||
sh ./docker/fonts/buildMetrics.sh | ||
sh ./dockers/fonts/buildMetrics.sh | ||
which should generate new metrics and place them into `fontMetricsData.json`. | ||
You're done! |
@@ -13,3 +13,3 @@ // @flow | ||
import type {AnyParseNode} from "./parseNode"; | ||
import type {MacroMap} from "./macros"; | ||
import type {MacroMap} from "./defineMacro"; | ||
@@ -16,0 +16,0 @@ export type StrictFunction = |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 60 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4280673
210
61541
120
67
60