@unified-latex/unified-latex-util-environments 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +7 -0
- package/dist/libs/process-environment.d.ts +15 -0
- package/dist/libs/process-environment.d.ts.map +1 -0
- package/dist/libs/unified-latex-process-environment.d.ts +14 -0
- package/dist/libs/unified-latex-process-environment.d.ts.map +1 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!-- DO NOT MODIFY -->
|
|
2
|
+
<!-- This file was autogenerated by build-docs.ts -->
|
|
3
|
+
<!-- Edit the docstring in index.ts and regenerate -->
|
|
4
|
+
<!-- rather than editing this file directly. -->
|
|
5
|
+
# unified-latex-util-environments
|
|
6
|
+
|
|
7
|
+
## What is this?
|
|
8
|
+
|
|
9
|
+
Functions to report on/manipulate environments in a `unified-latex` Abstract Syntax Tree (AST).
|
|
10
|
+
|
|
11
|
+
## When should I use this?
|
|
12
|
+
|
|
13
|
+
If you are working on the internals of `unified-latex-util-parse` or need to make a custom parser
|
|
14
|
+
that treats environments differently.
|
|
15
|
+
|
|
16
|
+
# Plugins
|
|
17
|
+
|
|
18
|
+
## `unifiedLatexProcessEnvironments`
|
|
19
|
+
|
|
20
|
+
Unified plugin to process environment content and attach arguments.
|
|
21
|
+
|
|
22
|
+
### Usage
|
|
23
|
+
|
|
24
|
+
`unified().use(unifiedLatexProcessEnvironments[, options])`
|
|
25
|
+
|
|
26
|
+
#### options
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
{ environments: Ast.EnvInfoRecord; }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Type
|
|
33
|
+
|
|
34
|
+
`Plugin<{ environments: Ast.EnvInfoRecord; }[], Ast.Root, Ast.Root>`
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
function unifiedLatexProcessEnvironments(options: {
|
|
38
|
+
environments: Ast.EnvInfoRecord;
|
|
39
|
+
}): (tree: Ast.Root) => void;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
# Functions
|
|
43
|
+
|
|
44
|
+
## `processEnvironment(envNode, envInfo)`
|
|
45
|
+
|
|
46
|
+
Performs any needed processing on the environment (as specified by `envInfo`)
|
|
47
|
+
include attaching arguments and possibly manipulating the environment's body.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
function processEnvironment(
|
|
51
|
+
envNode: Ast.Environment,
|
|
52
|
+
envInfo: Ast.EnvInfo
|
|
53
|
+
): void;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Parameters**
|
|
57
|
+
|
|
58
|
+
| Param | Type |
|
|
59
|
+
| :------ | :---------------- |
|
|
60
|
+
| envNode | `Ast.Environment` |
|
|
61
|
+
| envInfo | `Ast.EnvInfo` |
|
|
62
|
+
|
|
63
|
+
## `processEnvironments(tree, environments)`
|
|
64
|
+
|
|
65
|
+
Recursively search for and process the specified environments. Arguments are
|
|
66
|
+
consumed according to the `signature` specified. The body is processed
|
|
67
|
+
with the specified `processContent` function (if given). Any specified `renderInfo`
|
|
68
|
+
is attached to the environment node.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
function processEnvironments(
|
|
72
|
+
tree: Ast.Ast,
|
|
73
|
+
environments: Ast.EnvInfoRecord
|
|
74
|
+
): void;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Parameters**
|
|
78
|
+
|
|
79
|
+
| Param | Type |
|
|
80
|
+
| :----------- | :------------------ |
|
|
81
|
+
| tree | `Ast.Ast` |
|
|
82
|
+
| environments | `Ast.EnvInfoRecord` |
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../index.ts", "../libs/process-environment.ts", "../libs/unified-latex-process-environment.ts"],
|
|
4
|
+
"sourcesContent": ["export * from \"./libs/process-environment\";\nexport * from \"./libs/unified-latex-process-environment\";\n\n// NOTE: The docstring comment must be the last item in the index.ts file!\n/**\n * ## What is this?\n *\n * Functions to report on/manipulate environments in a `unified-latex` Abstract Syntax Tree (AST).\n *\n * ## When should I use this?\n *\n * If you are working on the internals of `unified-latex-util-parse` or need to make a custom parser\n * that treats environments differently.\n */\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { EnvInfo, EnvInfoRecord } from \"@unified-latex/unified-latex-types\";\nimport { updateRenderInfo } from \"@unified-latex/unified-latex-util-render-info\";\nimport { gobbleArguments } from \"@unified-latex/unified-latex-util-arguments\";\nimport { match } from \"@unified-latex/unified-latex-util-match\";\nimport { visit } from \"@unified-latex/unified-latex-util-visit\";\nimport { printRaw } from \"@unified-latex/unified-latex-util-print-raw\";\n\n/**\n * Performs any needed processing on the environment (as specified by `envInfo`)\n * include attaching arguments and possibly manipulating the environment's body.\n */\nexport function processEnvironment(envNode: Ast.Environment, envInfo: EnvInfo) {\n if (envInfo.signature && envNode.args == null) {\n const { args } = gobbleArguments(envNode.content, envInfo.signature);\n envNode.args = args;\n }\n\n updateRenderInfo(envNode, envInfo.renderInfo);\n if (typeof envInfo.processContent === \"function\") {\n envNode.content = envInfo.processContent(envNode.content);\n }\n}\n\n/**\n * Recursively search for and process the specified environments. Arguments are\n * consumed according to the `signature` specified. The body is processed\n * with the specified `processContent` function (if given). Any specified `renderInfo`\n * is attached to the environment node.\n */\nexport function processEnvironments(\n tree: Ast.Ast,\n environments: EnvInfoRecord\n) {\n const isRelevantEnvironment = match.createEnvironmentMatcher(environments);\n\n visit(\n tree,\n {\n leave: (node) => {\n const envName = printRaw(node.env);\n const envInfo = environments[envName];\n if (!envInfo) {\n throw new Error(\n `Could not find environment info for environment \"${envName}\"`\n );\n }\n processEnvironment(node, envInfo);\n },\n },\n { test: isRelevantEnvironment }\n );\n}\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { EnvInfoRecord } from \"@unified-latex/unified-latex-types\";\nimport { Plugin } from \"unified\";\nimport { visit } from \"@unified-latex/unified-latex-util-visit\";\nimport { match } from \"@unified-latex/unified-latex-util-match\";\nimport { processEnvironment } from \"./process-environment\";\nimport { printRaw } from \"@unified-latex/unified-latex-util-print-raw\";\n\ntype PluginOptions = { environments: EnvInfoRecord } | undefined;\n\n/**\n * Unified plugin to process environment content and attach arguments.\n *\n * @param environments An object whose keys are environment names and values contains information about the environment and its argument signature.\n */\nexport const unifiedLatexProcessEnvironments: Plugin<\n PluginOptions[],\n Ast.Root,\n Ast.Root\n> = function unifiedLatexAttachMacroArguments(options) {\n const { environments = {} } = options || {};\n const isRelevantEnvironment = match.createEnvironmentMatcher(environments);\n\n return (tree) => {\n if (Object.keys(environments).length === 0) {\n console.warn(\n \"Attempting to attach macro arguments but no macros are specified.\"\n );\n }\n\n visit(\n tree,\n {\n leave: (node) => {\n const envName = printRaw(node.env);\n const envInfo = environments[envName];\n if (!envInfo) {\n throw new Error(\n `Could not find environment info for environment \"${envName}\"`\n );\n }\n processEnvironment(node, envInfo);\n },\n },\n { test: isRelevantEnvironment }\n );\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,4CAAiC;AACjC,0CAAgC;AAChC,sCAAsB;AACtB,sCAAsB;AACtB,0CAAyB;AAMlB,4BAA4B,SAA0B,SAAkB;AAC3E,MAAI,QAAQ,aAAa,QAAQ,QAAQ,MAAM;AAC3C,UAAM,EAAE,SAAS,yDAAgB,QAAQ,SAAS,QAAQ,SAAS;AACnE,YAAQ,OAAO;AAAA,EACnB;AAEA,8DAAiB,SAAS,QAAQ,UAAU;AAC5C,MAAI,OAAO,QAAQ,mBAAmB,YAAY;AAC9C,YAAQ,UAAU,QAAQ,eAAe,QAAQ,OAAO;AAAA,EAC5D;AACJ;AAQO,6BACH,MACA,cACF;AACE,QAAM,wBAAwB,sCAAM,yBAAyB,YAAY;AAEzE,6CACI,MACA;AAAA,IACI,OAAO,CAAC,SAAS;AACb,YAAM,UAAU,kDAAS,KAAK,GAAG;AACjC,YAAM,UAAU,aAAa;AAC7B,UAAI,CAAC,SAAS;AACV,cAAM,IAAI,MACN,oDAAoD,UACxD;AAAA,MACJ;AACA,yBAAmB,MAAM,OAAO;AAAA,IACpC;AAAA,EACJ,GACA,EAAE,MAAM,sBAAsB,CAClC;AACJ;;;ACjDA,uCAAsB;AACtB,uCAAsB;AAEtB,2CAAyB;AASlB,IAAM,kCAIT,0CAA0C,SAAS;AACnD,QAAM,EAAE,eAAe,CAAC,MAAM,WAAW,CAAC;AAC1C,QAAM,wBAAwB,uCAAM,yBAAyB,YAAY;AAEzE,SAAO,CAAC,SAAS;AACb,QAAI,OAAO,KAAK,YAAY,EAAE,WAAW,GAAG;AACxC,cAAQ,KACJ,mEACJ;AAAA,IACJ;AAEA,gDACI,MACA;AAAA,MACI,OAAO,CAAC,SAAS;AACb,cAAM,UAAU,mDAAS,KAAK,GAAG;AACjC,cAAM,UAAU,aAAa;AAC7B,YAAI,CAAC,SAAS;AACV,gBAAM,IAAI,MACN,oDAAoD,UACxD;AAAA,QACJ;AACA,2BAAmB,MAAM,OAAO;AAAA,MACpC;AAAA,IACJ,GACA,EAAE,MAAM,sBAAsB,CAClC;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./libs/process-environment";
|
|
2
|
+
export * from "./libs/unified-latex-process-environment";
|
|
3
|
+
/**
|
|
4
|
+
* ## What is this?
|
|
5
|
+
*
|
|
6
|
+
* Functions to report on/manipulate environments in a `unified-latex` Abstract Syntax Tree (AST).
|
|
7
|
+
*
|
|
8
|
+
* ## When should I use this?
|
|
9
|
+
*
|
|
10
|
+
* If you are working on the internals of `unified-latex-util-parse` or need to make a custom parser
|
|
11
|
+
* that treats environments differently.
|
|
12
|
+
*/
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AAGzD;;;;;;;;;GASG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// libs/process-environment.ts
|
|
2
|
+
import { updateRenderInfo } from "@unified-latex/unified-latex-util-render-info";
|
|
3
|
+
import { gobbleArguments } from "@unified-latex/unified-latex-util-arguments";
|
|
4
|
+
import { match } from "@unified-latex/unified-latex-util-match";
|
|
5
|
+
import { visit } from "@unified-latex/unified-latex-util-visit";
|
|
6
|
+
import { printRaw } from "@unified-latex/unified-latex-util-print-raw";
|
|
7
|
+
function processEnvironment(envNode, envInfo) {
|
|
8
|
+
if (envInfo.signature && envNode.args == null) {
|
|
9
|
+
const { args } = gobbleArguments(envNode.content, envInfo.signature);
|
|
10
|
+
envNode.args = args;
|
|
11
|
+
}
|
|
12
|
+
updateRenderInfo(envNode, envInfo.renderInfo);
|
|
13
|
+
if (typeof envInfo.processContent === "function") {
|
|
14
|
+
envNode.content = envInfo.processContent(envNode.content);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function processEnvironments(tree, environments) {
|
|
18
|
+
const isRelevantEnvironment = match.createEnvironmentMatcher(environments);
|
|
19
|
+
visit(tree, {
|
|
20
|
+
leave: (node) => {
|
|
21
|
+
const envName = printRaw(node.env);
|
|
22
|
+
const envInfo = environments[envName];
|
|
23
|
+
if (!envInfo) {
|
|
24
|
+
throw new Error(`Could not find environment info for environment "${envName}"`);
|
|
25
|
+
}
|
|
26
|
+
processEnvironment(node, envInfo);
|
|
27
|
+
}
|
|
28
|
+
}, { test: isRelevantEnvironment });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// libs/unified-latex-process-environment.ts
|
|
32
|
+
import { visit as visit2 } from "@unified-latex/unified-latex-util-visit";
|
|
33
|
+
import { match as match2 } from "@unified-latex/unified-latex-util-match";
|
|
34
|
+
import { printRaw as printRaw2 } from "@unified-latex/unified-latex-util-print-raw";
|
|
35
|
+
var unifiedLatexProcessEnvironments = function unifiedLatexAttachMacroArguments(options) {
|
|
36
|
+
const { environments = {} } = options || {};
|
|
37
|
+
const isRelevantEnvironment = match2.createEnvironmentMatcher(environments);
|
|
38
|
+
return (tree) => {
|
|
39
|
+
if (Object.keys(environments).length === 0) {
|
|
40
|
+
console.warn("Attempting to attach macro arguments but no macros are specified.");
|
|
41
|
+
}
|
|
42
|
+
visit2(tree, {
|
|
43
|
+
leave: (node) => {
|
|
44
|
+
const envName = printRaw2(node.env);
|
|
45
|
+
const envInfo = environments[envName];
|
|
46
|
+
if (!envInfo) {
|
|
47
|
+
throw new Error(`Could not find environment info for environment "${envName}"`);
|
|
48
|
+
}
|
|
49
|
+
processEnvironment(node, envInfo);
|
|
50
|
+
}
|
|
51
|
+
}, { test: isRelevantEnvironment });
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
processEnvironment,
|
|
56
|
+
processEnvironments,
|
|
57
|
+
unifiedLatexProcessEnvironments
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../libs/process-environment.ts", "../libs/unified-latex-process-environment.ts"],
|
|
4
|
+
"sourcesContent": ["import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { EnvInfo, EnvInfoRecord } from \"@unified-latex/unified-latex-types\";\nimport { updateRenderInfo } from \"@unified-latex/unified-latex-util-render-info\";\nimport { gobbleArguments } from \"@unified-latex/unified-latex-util-arguments\";\nimport { match } from \"@unified-latex/unified-latex-util-match\";\nimport { visit } from \"@unified-latex/unified-latex-util-visit\";\nimport { printRaw } from \"@unified-latex/unified-latex-util-print-raw\";\n\n/**\n * Performs any needed processing on the environment (as specified by `envInfo`)\n * include attaching arguments and possibly manipulating the environment's body.\n */\nexport function processEnvironment(envNode: Ast.Environment, envInfo: EnvInfo) {\n if (envInfo.signature && envNode.args == null) {\n const { args } = gobbleArguments(envNode.content, envInfo.signature);\n envNode.args = args;\n }\n\n updateRenderInfo(envNode, envInfo.renderInfo);\n if (typeof envInfo.processContent === \"function\") {\n envNode.content = envInfo.processContent(envNode.content);\n }\n}\n\n/**\n * Recursively search for and process the specified environments. Arguments are\n * consumed according to the `signature` specified. The body is processed\n * with the specified `processContent` function (if given). Any specified `renderInfo`\n * is attached to the environment node.\n */\nexport function processEnvironments(\n tree: Ast.Ast,\n environments: EnvInfoRecord\n) {\n const isRelevantEnvironment = match.createEnvironmentMatcher(environments);\n\n visit(\n tree,\n {\n leave: (node) => {\n const envName = printRaw(node.env);\n const envInfo = environments[envName];\n if (!envInfo) {\n throw new Error(\n `Could not find environment info for environment \"${envName}\"`\n );\n }\n processEnvironment(node, envInfo);\n },\n },\n { test: isRelevantEnvironment }\n );\n}\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { EnvInfoRecord } from \"@unified-latex/unified-latex-types\";\nimport { Plugin } from \"unified\";\nimport { visit } from \"@unified-latex/unified-latex-util-visit\";\nimport { match } from \"@unified-latex/unified-latex-util-match\";\nimport { processEnvironment } from \"./process-environment\";\nimport { printRaw } from \"@unified-latex/unified-latex-util-print-raw\";\n\ntype PluginOptions = { environments: EnvInfoRecord } | undefined;\n\n/**\n * Unified plugin to process environment content and attach arguments.\n *\n * @param environments An object whose keys are environment names and values contains information about the environment and its argument signature.\n */\nexport const unifiedLatexProcessEnvironments: Plugin<\n PluginOptions[],\n Ast.Root,\n Ast.Root\n> = function unifiedLatexAttachMacroArguments(options) {\n const { environments = {} } = options || {};\n const isRelevantEnvironment = match.createEnvironmentMatcher(environments);\n\n return (tree) => {\n if (Object.keys(environments).length === 0) {\n console.warn(\n \"Attempting to attach macro arguments but no macros are specified.\"\n );\n }\n\n visit(\n tree,\n {\n leave: (node) => {\n const envName = printRaw(node.env);\n const envInfo = environments[envName];\n if (!envInfo) {\n throw new Error(\n `Could not find environment info for environment \"${envName}\"`\n );\n }\n processEnvironment(node, envInfo);\n },\n },\n { test: isRelevantEnvironment }\n );\n };\n};\n"],
|
|
5
|
+
"mappings": ";AAEA;AACA;AACA;AACA;AACA;AAMO,4BAA4B,SAA0B,SAAkB;AAC3E,MAAI,QAAQ,aAAa,QAAQ,QAAQ,MAAM;AAC3C,UAAM,EAAE,SAAS,gBAAgB,QAAQ,SAAS,QAAQ,SAAS;AACnE,YAAQ,OAAO;AAAA,EACnB;AAEA,mBAAiB,SAAS,QAAQ,UAAU;AAC5C,MAAI,OAAO,QAAQ,mBAAmB,YAAY;AAC9C,YAAQ,UAAU,QAAQ,eAAe,QAAQ,OAAO;AAAA,EAC5D;AACJ;AAQO,6BACH,MACA,cACF;AACE,QAAM,wBAAwB,MAAM,yBAAyB,YAAY;AAEzE,QACI,MACA;AAAA,IACI,OAAO,CAAC,SAAS;AACb,YAAM,UAAU,SAAS,KAAK,GAAG;AACjC,YAAM,UAAU,aAAa;AAC7B,UAAI,CAAC,SAAS;AACV,cAAM,IAAI,MACN,oDAAoD,UACxD;AAAA,MACJ;AACA,yBAAmB,MAAM,OAAO;AAAA,IACpC;AAAA,EACJ,GACA,EAAE,MAAM,sBAAsB,CAClC;AACJ;;;ACjDA;AACA;AAEA;AASO,IAAM,kCAIT,0CAA0C,SAAS;AACnD,QAAM,EAAE,eAAe,CAAC,MAAM,WAAW,CAAC;AAC1C,QAAM,wBAAwB,OAAM,yBAAyB,YAAY;AAEzE,SAAO,CAAC,SAAS;AACb,QAAI,OAAO,KAAK,YAAY,EAAE,WAAW,GAAG;AACxC,cAAQ,KACJ,mEACJ;AAAA,IACJ;AAEA,WACI,MACA;AAAA,MACI,OAAO,CAAC,SAAS;AACb,cAAM,UAAU,UAAS,KAAK,GAAG;AACjC,cAAM,UAAU,aAAa;AAC7B,YAAI,CAAC,SAAS;AACV,gBAAM,IAAI,MACN,oDAAoD,UACxD;AAAA,QACJ;AACA,2BAAmB,MAAM,OAAO;AAAA,MACpC;AAAA,IACJ,GACA,EAAE,MAAM,sBAAsB,CAClC;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Ast from "@unified-latex/unified-latex-types";
|
|
2
|
+
import { EnvInfo, EnvInfoRecord } from "@unified-latex/unified-latex-types";
|
|
3
|
+
/**
|
|
4
|
+
* Performs any needed processing on the environment (as specified by `envInfo`)
|
|
5
|
+
* include attaching arguments and possibly manipulating the environment's body.
|
|
6
|
+
*/
|
|
7
|
+
export declare function processEnvironment(envNode: Ast.Environment, envInfo: EnvInfo): void;
|
|
8
|
+
/**
|
|
9
|
+
* Recursively search for and process the specified environments. Arguments are
|
|
10
|
+
* consumed according to the `signature` specified. The body is processed
|
|
11
|
+
* with the specified `processContent` function (if given). Any specified `renderInfo`
|
|
12
|
+
* is attached to the environment node.
|
|
13
|
+
*/
|
|
14
|
+
export declare function processEnvironments(tree: Ast.Ast, environments: EnvInfoRecord): void;
|
|
15
|
+
//# sourceMappingURL=process-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-environment.d.ts","sourceRoot":"","sources":["../../libs/process-environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAO5E;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,QAU5E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,GAAG,CAAC,GAAG,EACb,YAAY,EAAE,aAAa,QAoB9B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Ast from "@unified-latex/unified-latex-types";
|
|
2
|
+
import { EnvInfoRecord } from "@unified-latex/unified-latex-types";
|
|
3
|
+
import { Plugin } from "unified";
|
|
4
|
+
declare type PluginOptions = {
|
|
5
|
+
environments: EnvInfoRecord;
|
|
6
|
+
} | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Unified plugin to process environment content and attach arguments.
|
|
9
|
+
*
|
|
10
|
+
* @param environments An object whose keys are environment names and values contains information about the environment and its argument signature.
|
|
11
|
+
*/
|
|
12
|
+
export declare const unifiedLatexProcessEnvironments: Plugin<PluginOptions[], Ast.Root, Ast.Root>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=unified-latex-process-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-latex-process-environment.d.ts","sourceRoot":"","sources":["../../libs/unified-latex-process-environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAMjC,aAAK,aAAa,GAAG;IAAE,YAAY,EAAE,aAAa,CAAA;CAAE,GAAG,SAAS,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAChD,aAAa,EAAE,EACf,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,IAAI,CA6BX,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unified-latex/unified-latex-util-environments",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Tools for manipulating unified-latex ASTs",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@unified-latex/unified-latex-types": "*",
|
|
9
|
+
"@unified-latex/unified-latex-util-match": "*",
|
|
10
|
+
"@unified-latex/unified-latex-util-print-raw": "*",
|
|
11
|
+
"@unified-latex/unified-latex-util-render-info": "*",
|
|
12
|
+
"@unified-latex/unified-latex-util-arguments": "*",
|
|
13
|
+
"@unified-latex/unified-latex-util-visit": "*"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/**/*.ts",
|
|
17
|
+
"dist/**/*.js",
|
|
18
|
+
"dist/**/*.map",
|
|
19
|
+
"dist/**/*.json"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./*js": "./dist/*js",
|
|
27
|
+
"./*": {
|
|
28
|
+
"import": "./dist/*.js",
|
|
29
|
+
"require": "./dist/*.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "npm run clean && mkdirp ./dist && npm run compile",
|
|
34
|
+
"clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo",
|
|
35
|
+
"compile": "tsc -b tsconfig.json & node build.js & wait",
|
|
36
|
+
"test": "jest"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/siefkenj/unified-latex.git"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"pegjs",
|
|
44
|
+
"latex",
|
|
45
|
+
"parser",
|
|
46
|
+
"prettier",
|
|
47
|
+
"unified-latex",
|
|
48
|
+
"unified"
|
|
49
|
+
],
|
|
50
|
+
"author": "Jason Siefken",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/siefkenj/unified-latex/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://github.com/siefkenj/unified-latex#readme",
|
|
56
|
+
"jest": {
|
|
57
|
+
"transformIgnorePatterns": [
|
|
58
|
+
"node_modules/(?!unified|bail|is-plain-obj|trough|vfile.*|unist.*|hast.*|property-information|html-void-elements|.*-separated-tokens|.*entities.*|ccount|rehype*|string-width|strip-ansi|ansi-regex|supports-color)"
|
|
59
|
+
],
|
|
60
|
+
"transform": {
|
|
61
|
+
"\\.m?jsx?$": "esbuild-jest",
|
|
62
|
+
"latex.pegjs$": "<rootDir>/../../tests/pegjs-preprocessor-latex.js",
|
|
63
|
+
"\\.pegjs$": "<rootDir>/../../tests/pegjs-preprocessor.js",
|
|
64
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|