@unified-latex/unified-latex-util-environments
Advanced tools
Comparing version 1.6.1 to 1.7.0
@@ -1,13 +0,31 @@ | ||
export * from "./libs/process-environment"; | ||
export * from "./libs/unified-latex-process-environment"; | ||
import * as Ast from '@unified-latex/unified-latex-types'; | ||
import { EnvInfo } from '@unified-latex/unified-latex-types'; | ||
import { EnvInfoRecord } from '@unified-latex/unified-latex-types'; | ||
import { Plugin as Plugin_2 } from 'unified'; | ||
declare type PluginOptions = { | ||
environments: EnvInfoRecord; | ||
} | undefined; | ||
/** | ||
* ## What is this? | ||
* Performs any needed processing on the environment (as specified by `envInfo`) | ||
* including attaching arguments and possibly manipulating the environment's body. | ||
*/ | ||
export declare function processEnvironment(envNode: Ast.Environment, envInfo: EnvInfo): void; | ||
/** | ||
* Recursively search for and process the specified environments. Arguments are | ||
* consumed according to the `signature` specified. The body is processed | ||
* with the specified `processContent` function (if given). Any specified `renderInfo` | ||
* is attached to the environment node. | ||
*/ | ||
export declare function processEnvironments(tree: Ast.Ast, environments: EnvInfoRecord): void; | ||
/** | ||
* Unified plugin to process environment content and attach arguments. | ||
* | ||
* Functions to report on/manipulate environments in a `unified-latex` Abstract Syntax Tree (AST). | ||
* | ||
* ## When should I use this? | ||
* | ||
* If you are working on the internals of `unified-latex-util-parse` or need to make a custom parser | ||
* that treats environments differently. | ||
* @param environments An object whose keys are environment names and values contains information about the environment and its argument signature. | ||
*/ | ||
//# sourceMappingURL=index.d.ts.map | ||
export declare const unifiedLatexProcessEnvironments: Plugin_2<PluginOptions[], Ast.Root, Ast.Root>; | ||
export { } |
14
index.js
@@ -1,2 +0,1 @@ | ||
// libs/process-environment.ts | ||
import { updateRenderInfo } from "@unified-latex/unified-latex-util-render-info"; | ||
@@ -36,10 +35,5 @@ import { gobbleArguments } from "@unified-latex/unified-latex-util-arguments"; | ||
} | ||
// libs/unified-latex-process-environment.ts | ||
import { visit as visit2 } from "@unified-latex/unified-latex-util-visit"; | ||
import { match as match2 } from "@unified-latex/unified-latex-util-match"; | ||
import { printRaw as printRaw2 } from "@unified-latex/unified-latex-util-print-raw"; | ||
var unifiedLatexProcessEnvironments = function unifiedLatexAttachMacroArguments(options) { | ||
const unifiedLatexProcessEnvironments = function unifiedLatexAttachMacroArguments(options) { | ||
const { environments = {} } = options || {}; | ||
const isRelevantEnvironment = match2.createEnvironmentMatcher(environments); | ||
const isRelevantEnvironment = match.createEnvironmentMatcher(environments); | ||
return (tree) => { | ||
@@ -51,7 +45,7 @@ if (Object.keys(environments).length === 0) { | ||
} | ||
visit2( | ||
visit( | ||
tree, | ||
{ | ||
leave: (node) => { | ||
const envName = printRaw2(node.env); | ||
const envName = printRaw(node.env); | ||
const envInfo = environments[envName]; | ||
@@ -58,0 +52,0 @@ if (!envInfo) { |
{ | ||
"name": "@unified-latex/unified-latex-util-environments", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"description": "Tools for manipulating unified-latex ASTs", | ||
@@ -8,8 +8,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"@unified-latex/unified-latex-types": "^1.6.1", | ||
"@unified-latex/unified-latex-util-arguments": "^1.6.1", | ||
"@unified-latex/unified-latex-util-match": "^1.6.1", | ||
"@unified-latex/unified-latex-util-print-raw": "^1.6.1", | ||
"@unified-latex/unified-latex-util-render-info": "^1.6.1", | ||
"@unified-latex/unified-latex-util-visit": "^1.6.1", | ||
"@unified-latex/unified-latex-types": "^1.7.0", | ||
"@unified-latex/unified-latex-util-arguments": "^1.7.0", | ||
"@unified-latex/unified-latex-util-match": "^1.7.0", | ||
"@unified-latex/unified-latex-util-print-raw": "^1.7.0", | ||
"@unified-latex/unified-latex-util-render-info": "^1.7.0", | ||
"@unified-latex/unified-latex-util-visit": "^1.7.0", | ||
"unified": "^10.1.2" | ||
@@ -16,0 +16,0 @@ }, |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20769
7
160
1