@unified-latex/unified-latex-types 1.2.2 → 1.3.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 +37 -0
- package/libs/info-specs.d.ts +32 -0
- package/libs/info-specs.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,15 @@ import the `.js` file. To explicitly access the commonjs export, import the `.cj
|
|
|
24
24
|
|
|
25
25
|
# Types
|
|
26
26
|
|
|
27
|
+
## `ArgumentParser`
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
export type ArgumentParser = (
|
|
31
|
+
nodes: Ast.Node[],
|
|
32
|
+
startPos: number
|
|
33
|
+
) => { args: Ast.Argument[]; nodesRemoved: number };
|
|
34
|
+
```
|
|
35
|
+
|
|
27
36
|
## `Ast`
|
|
28
37
|
|
|
29
38
|
```typescript
|
|
@@ -65,6 +74,12 @@ export type EnvInfo = {
|
|
|
65
74
|
* @type {((string|null)[])}
|
|
66
75
|
*/
|
|
67
76
|
namedArguments?: (string | null)[];
|
|
77
|
+
/**
|
|
78
|
+
* Whether the body is tikz-environment like (e.g., a `tikzpicture` or `scope`, etc.)
|
|
79
|
+
*
|
|
80
|
+
* @type {boolean}
|
|
81
|
+
*/
|
|
82
|
+
tikzEnvironment?: boolean;
|
|
68
83
|
};
|
|
69
84
|
/**
|
|
70
85
|
* Function to process the body of an environment. The return value of `processContent`
|
|
@@ -142,6 +157,12 @@ export type MacroInfo = {
|
|
|
142
157
|
* @type {((string|null)[])}
|
|
143
158
|
*/
|
|
144
159
|
namedArguments?: (string | null)[];
|
|
160
|
+
/**
|
|
161
|
+
* Whether the macro represents a tikz path command (e.g. `\draw (0,0) -- (1,1);`).
|
|
162
|
+
*
|
|
163
|
+
* @type {boolean}
|
|
164
|
+
*/
|
|
165
|
+
tikzPathCommand?: boolean;
|
|
145
166
|
};
|
|
146
167
|
/**
|
|
147
168
|
* The macro signature as an xparse argument specification string.
|
|
@@ -156,6 +177,22 @@ export type MacroInfo = {
|
|
|
156
177
|
* escape token.
|
|
157
178
|
*/
|
|
158
179
|
escapeToken?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Custom argument parser. If present, function overrides the default argument
|
|
182
|
+
* parsing of `signature`. An array of nodes is passed as well as the position
|
|
183
|
+
* of the first node **after** the macro. This function is expected to _mutate_
|
|
184
|
+
* the input array, removing any nodes that are part of the macro's argument.
|
|
185
|
+
*
|
|
186
|
+
* This function will only be called on a macro if it has no existing `args`.
|
|
187
|
+
*
|
|
188
|
+
* Note: for stability when printing/accessing a node's arguments, this function
|
|
189
|
+
* should always return an argument array of the same length, regardless of
|
|
190
|
+
* whether optional arguments are present. For example, if this function parses
|
|
191
|
+
* a node with signature `o m`, it should ways return a length-two array of arguments.
|
|
192
|
+
* A "blank" argument (one that does not show up during printing) can be created
|
|
193
|
+
* with `args([], { openMark: "", closeMark: "" })`, using the `unified-latex-builder` package.
|
|
194
|
+
*/
|
|
195
|
+
argumentParser?: ArgumentParser;
|
|
159
196
|
};
|
|
160
197
|
```
|
|
161
198
|
|
package/libs/info-specs.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as Ast from "./ast-types";
|
|
2
|
+
export type ArgumentParser = (nodes: Ast.Node[], startPos: number) => {
|
|
3
|
+
args: Ast.Argument[];
|
|
4
|
+
nodesRemoved: number;
|
|
5
|
+
};
|
|
2
6
|
export type EnvInfo = {
|
|
3
7
|
renderInfo?: {
|
|
4
8
|
/**
|
|
@@ -31,6 +35,12 @@ export type EnvInfo = {
|
|
|
31
35
|
* @type {((string|null)[])}
|
|
32
36
|
*/
|
|
33
37
|
namedArguments?: (string | null)[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether the body is tikz-environment like (e.g., a `tikzpicture` or `scope`, etc.)
|
|
40
|
+
*
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
tikzEnvironment?: boolean;
|
|
34
44
|
};
|
|
35
45
|
/**
|
|
36
46
|
* Function to process the body of an environment. The return value of `processContent`
|
|
@@ -91,6 +101,12 @@ export type MacroInfo = {
|
|
|
91
101
|
* @type {((string|null)[])}
|
|
92
102
|
*/
|
|
93
103
|
namedArguments?: (string | null)[];
|
|
104
|
+
/**
|
|
105
|
+
* Whether the macro represents a tikz path command (e.g. `\draw (0,0) -- (1,1);`).
|
|
106
|
+
*
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
*/
|
|
109
|
+
tikzPathCommand?: boolean;
|
|
94
110
|
};
|
|
95
111
|
/**
|
|
96
112
|
* The macro signature as an xparse argument specification string.
|
|
@@ -105,6 +121,22 @@ export type MacroInfo = {
|
|
|
105
121
|
* escape token.
|
|
106
122
|
*/
|
|
107
123
|
escapeToken?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Custom argument parser. If present, function overrides the default argument
|
|
126
|
+
* parsing of `signature`. An array of nodes is passed as well as the position
|
|
127
|
+
* of the first node **after** the macro. This function is expected to _mutate_
|
|
128
|
+
* the input array, removing any nodes that are part of the macro's argument.
|
|
129
|
+
*
|
|
130
|
+
* This function will only be called on a macro if it has no existing `args`.
|
|
131
|
+
*
|
|
132
|
+
* Note: for stability when printing/accessing a node's arguments, this function
|
|
133
|
+
* should always return an argument array of the same length, regardless of
|
|
134
|
+
* whether optional arguments are present. For example, if this function parses
|
|
135
|
+
* a node with signature `o m`, it should ways return a length-two array of arguments.
|
|
136
|
+
* A "blank" argument (one that does not show up during printing) can be created
|
|
137
|
+
* with `args([], { openMark: "", closeMark: "" })`, using the `unified-latex-builder` package.
|
|
138
|
+
*/
|
|
139
|
+
argumentParser?: ArgumentParser;
|
|
108
140
|
};
|
|
109
141
|
export type EnvInfoRecord = Record<string, EnvInfo>;
|
|
110
142
|
export type MacroInfoRecord = Record<string, MacroInfo>;
|
package/libs/info-specs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-specs.d.ts","sourceRoot":"","sources":["../../libs/info-specs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,MAAM,MAAM,OAAO,GAAG;IAClB,UAAU,CAAC,EAAE;QACT;;;;WAIG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB;;;;;WAKG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB;;;;WAIG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;;;;;;;WASG;QACH,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"info-specs.d.ts","sourceRoot":"","sources":["../../libs/info-specs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,MAAM,MAAM,cAAc,GAAG,CACzB,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,EACjB,QAAQ,EAAE,MAAM,KACf;IAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,MAAM,MAAM,OAAO,GAAG;IAClB,UAAU,CAAC,EAAE;QACT;;;;WAIG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB;;;;;WAKG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB;;;;WAIG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;;;;;;;WASG;QACH,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;QACnC;;;;WAIG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B,CAAC;IACF;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;IACjD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,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