document-ir 0.0.15 → 0.1.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.
Files changed (54) hide show
  1. package/{esm → dist}/ArrayCollapseTransformer.d.ts +2 -2
  2. package/{script → dist}/DocumentThinningTransformer.d.ts +2 -2
  3. package/dist/ExampleDocument.d.ts +2 -0
  4. package/{esm → dist}/IdentityTransformer.d.ts +1 -1
  5. package/{esm → dist}/NodeVisitor.d.ts +1 -1
  6. package/{esm → dist}/TextCollapseTransformer.d.ts +2 -2
  7. package/{script → dist}/TextVisitor.d.ts +2 -2
  8. package/{script → dist}/WhitespaceStretchingTransformer.d.ts +2 -2
  9. package/{script → dist}/WhitespaceTransformer.d.ts +2 -2
  10. package/{script → dist}/WordCountTransformer.d.ts +2 -2
  11. package/{script → dist}/WordCounterVisitor.d.ts +2 -2
  12. package/dist/index.d.ts +11 -0
  13. package/dist/index.js +1378 -0
  14. package/package.json +40 -11
  15. package/esm/ArrayCollapseTransformer.js +0 -18
  16. package/esm/DocumentThinningTransformer.d.ts +0 -16
  17. package/esm/DocumentThinningTransformer.js +0 -246
  18. package/esm/IdentityTransformer.js +0 -866
  19. package/esm/NodeVisitor.js +0 -414
  20. package/esm/TextCollapseTransformer.js +0 -36
  21. package/esm/TextVisitor.d.ts +0 -15
  22. package/esm/TextVisitor.js +0 -55
  23. package/esm/WhitespaceStretchingTransformer.d.ts +0 -26
  24. package/esm/WhitespaceStretchingTransformer.js +0 -121
  25. package/esm/WhitespaceTransformer.d.ts +0 -12
  26. package/esm/WhitespaceTransformer.js +0 -75
  27. package/esm/WordCountTransformer.d.ts +0 -6
  28. package/esm/WordCountTransformer.js +0 -83
  29. package/esm/WordCounterVisitor.d.ts +0 -13
  30. package/esm/WordCounterVisitor.js +0 -43
  31. package/esm/index.d.ts +0 -11
  32. package/esm/index.js +0 -11
  33. package/esm/package.json +0 -3
  34. package/esm/types.js +0 -1
  35. package/script/ArrayCollapseTransformer.d.ts +0 -5
  36. package/script/ArrayCollapseTransformer.js +0 -22
  37. package/script/DocumentThinningTransformer.js +0 -250
  38. package/script/IdentityTransformer.d.ts +0 -59
  39. package/script/IdentityTransformer.js +0 -870
  40. package/script/NodeVisitor.d.ts +0 -59
  41. package/script/NodeVisitor.js +0 -418
  42. package/script/TextCollapseTransformer.d.ts +0 -5
  43. package/script/TextCollapseTransformer.js +0 -40
  44. package/script/TextVisitor.js +0 -59
  45. package/script/WhitespaceStretchingTransformer.js +0 -125
  46. package/script/WhitespaceTransformer.js +0 -79
  47. package/script/WordCountTransformer.js +0 -87
  48. package/script/WordCounterVisitor.js +0 -47
  49. package/script/index.d.ts +0 -11
  50. package/script/index.js +0 -38
  51. package/script/package.json +0 -3
  52. package/script/types.d.ts +0 -351
  53. package/script/types.js +0 -2
  54. /package/{esm → dist}/types.d.ts +0 -0
@@ -1,59 +0,0 @@
1
- import { ArrayNode, BlockNode, BlockQuoteNode, BoldNode, BreakNode, BubbleNode, CardNode, CenterNode, CodeNode, ColumnsNode, DateNode, DateTimeNode, DefinitionListNode, DefinitionNode, DefinitionReferenceNode, DocumentNode, EmbedNode, EmojiNode, FigureCaptionNode, FigureImageNode, FigureNode, FormattedTextNode, HeaderNode, HighTechAlertNode, HorizontalRuleNode, ImageNode, ItalicNode, LinkNode, ListNode, Node, NoteNode, ParagraphNode, QuoteNode, RedactedNode, RegionNode, ScriptNode, SecretNode, SmallerNode, SocialNode, StickerNode, StrikeThroughNode, SubTextNode, SuperTextNode, TableNode, TableOfContentsNode, TextNode, TimeNode, UnderlineNode, VideoNode, WarningNode } from "./types.js";
2
- export declare class NodeVisitor {
3
- protected beforeBlock(): void;
4
- protected afterBlock(): void;
5
- protected beforeInline(): void;
6
- protected afterInline(): void;
7
- protected chooseChildren(nodes: Node[]): void;
8
- protected block(node: BlockNode): void;
9
- protected blockQuote(node: BlockQuoteNode): void;
10
- protected bold(node: BoldNode): void;
11
- protected break_(_node: BreakNode): void;
12
- protected bubble(node: BubbleNode): void;
13
- protected center(node: CenterNode): void;
14
- protected code(node: CodeNode): void;
15
- protected columns(node: ColumnsNode): void;
16
- protected definition(node: DefinitionNode): void;
17
- protected definitionList(node: DefinitionListNode): void;
18
- protected definitionReference(node: DefinitionReferenceNode): void;
19
- protected embed(_node: EmbedNode): void;
20
- protected emoji(_node: EmojiNode): void;
21
- protected figure(node: FigureNode): void;
22
- protected figureCaption(node: FigureCaptionNode): void;
23
- protected figureImage(node: FigureImageNode): void;
24
- protected formattedText(_node: FormattedTextNode): void;
25
- protected header(node: HeaderNode): void;
26
- protected highTechAlert(node: HighTechAlertNode): void;
27
- protected horizontalRule(_node: HorizontalRuleNode): void;
28
- protected image(_node: ImageNode): void;
29
- protected italic(node: ItalicNode): void;
30
- protected link(node: LinkNode): void;
31
- protected array(node: ArrayNode): void;
32
- protected note(node: NoteNode): void;
33
- protected list(node: ListNode): void;
34
- protected paragraph(node: ParagraphNode): void;
35
- protected quote(node: QuoteNode): void;
36
- protected redacted(node: RedactedNode): void;
37
- protected region(node: RegionNode): void;
38
- protected script(_node: ScriptNode): void;
39
- protected secret(node: SecretNode): void;
40
- protected smaller(node: SmallerNode): void;
41
- protected sticker(node: StickerNode): void;
42
- protected strikeThrough(node: StrikeThroughNode): void;
43
- protected text(_node: TextNode): void;
44
- protected table(node: TableNode): void;
45
- protected social(_node: SocialNode): void;
46
- protected underline(node: UnderlineNode): void;
47
- protected video(node: VideoNode): void;
48
- protected warning(node: WarningNode): void;
49
- protected card(node: CardNode): void;
50
- protected date(node: DateNode): void;
51
- protected time(node: TimeNode): void;
52
- protected datetime(node: DateTimeNode): void;
53
- protected subText(node: SubTextNode): void;
54
- protected superText(node: SuperTextNode): void;
55
- protected toc(node: TableOfContentsNode): void;
56
- protected choose(node: Node): void;
57
- protected document(node: DocumentNode): void;
58
- visit(node: DocumentNode | Node): void;
59
- }
@@ -1,418 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeVisitor = void 0;
4
- class NodeVisitor {
5
- beforeBlock() {
6
- }
7
- afterBlock() {
8
- }
9
- beforeInline() {
10
- }
11
- afterInline() {
12
- }
13
- chooseChildren(nodes) {
14
- for (const child of nodes) {
15
- this.choose(child);
16
- }
17
- }
18
- block(node) {
19
- this.beforeBlock();
20
- this.chooseChildren(node.content);
21
- this.afterBlock();
22
- }
23
- blockQuote(node) {
24
- this.beforeBlock();
25
- this.chooseChildren(node.content);
26
- this.afterBlock();
27
- }
28
- bold(node) {
29
- this.beforeInline();
30
- this.chooseChildren(node.content);
31
- this.afterInline();
32
- }
33
- break_(_node) {
34
- this.beforeBlock();
35
- this.afterBlock();
36
- }
37
- bubble(node) {
38
- this.beforeBlock();
39
- this.chooseChildren(node.content);
40
- this.afterBlock();
41
- }
42
- center(node) {
43
- this.beforeBlock();
44
- this.chooseChildren(node.content);
45
- this.afterBlock();
46
- }
47
- code(node) {
48
- this.beforeInline();
49
- this.chooseChildren(node.content);
50
- this.afterInline();
51
- }
52
- columns(node) {
53
- for (const column of node.columns) {
54
- this.beforeBlock();
55
- this.chooseChildren(column);
56
- this.afterBlock();
57
- }
58
- }
59
- definition(node) {
60
- this.beforeBlock();
61
- this.chooseChildren(node.abbreviation);
62
- this.afterBlock();
63
- this.beforeBlock();
64
- this.chooseChildren(node.title);
65
- this.afterBlock();
66
- this.beforeBlock();
67
- this.chooseChildren(node.content);
68
- this.afterBlock();
69
- }
70
- definitionList(node) {
71
- this.beforeBlock();
72
- for (const child of node.content) {
73
- this.definition(child);
74
- }
75
- this.afterBlock();
76
- }
77
- definitionReference(node) {
78
- this.beforeInline();
79
- this.chooseChildren(node.definition.abbreviation);
80
- this.afterInline();
81
- this.chooseChildren(node.content);
82
- }
83
- embed(_node) {
84
- }
85
- emoji(_node) {
86
- }
87
- figure(node) {
88
- this.beforeBlock();
89
- this.chooseChildren(node.content);
90
- this.afterBlock();
91
- }
92
- figureCaption(node) {
93
- this.beforeBlock();
94
- this.chooseChildren(node.content);
95
- this.afterBlock();
96
- }
97
- figureImage(node) {
98
- this.beforeBlock();
99
- this.chooseChildren(node.content);
100
- this.afterBlock();
101
- }
102
- formattedText(_node) {
103
- }
104
- header(node) {
105
- this.beforeBlock();
106
- this.chooseChildren(node.content);
107
- this.afterBlock();
108
- }
109
- highTechAlert(node) {
110
- this.beforeBlock();
111
- this.chooseChildren(node.content);
112
- this.afterBlock();
113
- this.beforeBlock();
114
- this.chooseChildren(node.warning);
115
- this.afterBlock();
116
- }
117
- horizontalRule(_node) {
118
- }
119
- image(_node) {
120
- }
121
- italic(node) {
122
- this.beforeInline();
123
- this.chooseChildren(node.content);
124
- this.afterInline();
125
- }
126
- link(node) {
127
- this.beforeInline();
128
- this.chooseChildren(node.content);
129
- this.afterInline();
130
- }
131
- array(node) {
132
- this.chooseChildren(node.content);
133
- }
134
- note(node) {
135
- this.beforeBlock();
136
- this.chooseChildren(node.content);
137
- this.afterBlock();
138
- }
139
- list(node) {
140
- for (const item of node.content) {
141
- this.beforeBlock();
142
- this.chooseChildren(item.content);
143
- this.afterBlock();
144
- }
145
- }
146
- paragraph(node) {
147
- this.beforeBlock();
148
- this.chooseChildren(node.content);
149
- this.afterBlock();
150
- }
151
- quote(node) {
152
- this.beforeBlock();
153
- this.chooseChildren(node.content);
154
- this.afterBlock();
155
- }
156
- redacted(node) {
157
- if (node.style == "block") {
158
- this.beforeBlock();
159
- }
160
- else {
161
- this.beforeInline();
162
- }
163
- this.chooseChildren(node.content);
164
- if (node.style == "block") {
165
- this.afterBlock();
166
- }
167
- else {
168
- this.afterInline();
169
- }
170
- }
171
- region(node) {
172
- this.beforeBlock();
173
- this.chooseChildren(node.content);
174
- this.afterBlock();
175
- }
176
- script(_node) {
177
- }
178
- secret(node) {
179
- this.beforeInline();
180
- this.chooseChildren(node.content);
181
- this.afterInline();
182
- }
183
- smaller(node) {
184
- this.beforeInline();
185
- this.chooseChildren(node.content);
186
- this.afterInline();
187
- }
188
- sticker(node) {
189
- this.beforeBlock();
190
- this.chooseChildren(node.content);
191
- this.afterBlock();
192
- }
193
- strikeThrough(node) {
194
- this.beforeInline();
195
- this.chooseChildren(node.content);
196
- this.afterInline();
197
- }
198
- text(_node) {
199
- }
200
- table(node) {
201
- for (const row of node.content) {
202
- for (const cell of row) {
203
- this.beforeBlock();
204
- this.chooseChildren(cell.content);
205
- this.afterBlock();
206
- }
207
- }
208
- }
209
- social(_node) {
210
- }
211
- underline(node) {
212
- this.beforeInline();
213
- this.chooseChildren(node.content);
214
- this.afterInline();
215
- }
216
- video(node) {
217
- this.beforeBlock();
218
- node.content && this.chooseChildren(node.content);
219
- this.afterBlock();
220
- }
221
- warning(node) {
222
- this.beforeBlock();
223
- this.chooseChildren(node.content);
224
- this.afterBlock();
225
- }
226
- card(node) {
227
- if (node.content) {
228
- this.beforeBlock();
229
- this.chooseChildren(node.content.content);
230
- this.afterBlock();
231
- }
232
- if (node.attribution) {
233
- if (node.attribution.title) {
234
- this.beforeBlock();
235
- const _title = this.chooseChildren(node.attribution.title);
236
- this.afterBlock();
237
- }
238
- }
239
- if (node.header) {
240
- this.beforeBlock();
241
- this.chooseChildren(node.header.title);
242
- this.afterBlock();
243
- }
244
- if (node.media) {
245
- for (const mediaNode of node.media.content) {
246
- this.beforeBlock();
247
- this.choose(mediaNode);
248
- this.afterBlock();
249
- }
250
- }
251
- }
252
- date(node) {
253
- this.beforeInline();
254
- this.chooseChildren(node.content);
255
- this.afterInline();
256
- }
257
- time(node) {
258
- this.beforeInline();
259
- this.chooseChildren(node.content);
260
- this.afterInline();
261
- }
262
- datetime(node) {
263
- this.beforeInline();
264
- this.chooseChildren(node.content);
265
- this.afterInline();
266
- }
267
- subText(node) {
268
- this.beforeInline();
269
- this.chooseChildren(node.content);
270
- this.afterInline();
271
- }
272
- superText(node) {
273
- this.beforeInline();
274
- this.chooseChildren(node.content);
275
- this.afterInline();
276
- }
277
- toc(node) {
278
- this.beforeBlock();
279
- this.chooseChildren(node.content);
280
- this.afterBlock();
281
- this.beforeBlock();
282
- this.chooseChildren(node.children);
283
- this.afterBlock();
284
- }
285
- choose(node) {
286
- if (!node || !node.type) {
287
- throw new Error(`Unexpected node, no type: ${JSON.stringify(node)}`);
288
- }
289
- try {
290
- switch (node.type) {
291
- case "block":
292
- return this.block(node);
293
- case "block-quote":
294
- return this.blockQuote(node);
295
- case "bold":
296
- return this.bold(node);
297
- case "break":
298
- return this.break_(node);
299
- case "bubble":
300
- return this.bubble(node);
301
- case "card":
302
- return this.card(node);
303
- case "center":
304
- return this.center(node);
305
- case "code":
306
- return this.code(node);
307
- case "columns":
308
- return this.columns(node);
309
- case "definition":
310
- return this.definition(node);
311
- case "definition-list":
312
- return this.definitionList(node);
313
- case "definition-reference":
314
- return this.definitionReference(node);
315
- case "embed":
316
- return this.embed(node);
317
- case "emoji":
318
- return this.emoji(node);
319
- case "figure":
320
- return this.figure(node);
321
- case "figure-caption":
322
- return this.figureCaption(node);
323
- case "figure-image":
324
- return this.figureImage(node);
325
- case "formatted-text":
326
- return this.formattedText(node);
327
- case "header":
328
- return this.header(node);
329
- case "high-tech-alert":
330
- return this.highTechAlert(node);
331
- case "horizontal-rule":
332
- return this.horizontalRule(node);
333
- case "image":
334
- return this.image(node);
335
- case "italic":
336
- return this.italic(node);
337
- case "link":
338
- return this.link(node);
339
- case "array":
340
- return this.array(node);
341
- case "note":
342
- return this.note(node);
343
- case "list":
344
- return this.list(node);
345
- case "paragraph":
346
- return this.paragraph(node);
347
- case "quote":
348
- return this.quote(node);
349
- case "redacted":
350
- return this.redacted(node);
351
- case "region":
352
- return this.region(node);
353
- case "script":
354
- return this.script(node);
355
- case "secret":
356
- return this.secret(node);
357
- case "smaller":
358
- return this.smaller(node);
359
- case "sticker":
360
- return this.sticker(node);
361
- case "strike-through":
362
- return this.strikeThrough(node);
363
- case "table":
364
- return this.table(node);
365
- case "text":
366
- return this.text(node);
367
- case "toot":
368
- case "tweet":
369
- case "vimeo":
370
- case "youtube":
371
- return this.social(node);
372
- case "underline":
373
- return this.underline(node);
374
- case "video":
375
- return this.video(node);
376
- case "warning":
377
- return this.warning(node);
378
- case "date":
379
- return this.date(node);
380
- case "time":
381
- return this.time(node);
382
- case "datetime":
383
- return this.datetime(node);
384
- case "sub":
385
- return this.subText(node);
386
- case "super":
387
- return this.superText(node);
388
- case "toc":
389
- return this.toc(node);
390
- }
391
- }
392
- catch (e) {
393
- console.log(`Got exception while processing node: ${JSON.stringify(node)}`);
394
- throw e;
395
- }
396
- //@ts-ignore Fall through
397
- console.error(`Unsupported type ${node.type}`);
398
- }
399
- document(node) {
400
- this.beforeBlock();
401
- this.chooseChildren(node.content);
402
- this.afterBlock();
403
- this.beforeBlock();
404
- if (node.definitions) {
405
- this.chooseChildren(node.definitions);
406
- }
407
- this.afterBlock();
408
- }
409
- visit(node) {
410
- if (node.type == "document") {
411
- this.document(node);
412
- }
413
- else {
414
- this.choose(node);
415
- }
416
- }
417
- }
418
- exports.NodeVisitor = NodeVisitor;
@@ -1,5 +0,0 @@
1
- import { IdentityTransformer } from "./IdentityTransformer.js";
2
- import { Node } from "./types.js";
3
- export declare class TextCollapseTransformer extends IdentityTransformer {
4
- protected chooseChildren(nodes: Node[]): Promise<Node[]>;
5
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextCollapseTransformer = void 0;
4
- const IdentityTransformer_js_1 = require("./IdentityTransformer.js");
5
- class TextCollapseTransformer extends IdentityTransformer_js_1.IdentityTransformer {
6
- async chooseChildren(nodes) {
7
- const children = await super.chooseChildren(nodes);
8
- const results = [];
9
- let lastText = null;
10
- for (const child of children) {
11
- if (child.type == "text") {
12
- if (lastText != null) {
13
- lastText = `${lastText}${child.text}`;
14
- }
15
- else {
16
- lastText = child.text;
17
- }
18
- }
19
- else {
20
- if (lastText != null) {
21
- results.push({
22
- type: "text",
23
- text: lastText,
24
- });
25
- lastText = null;
26
- }
27
- results.push(child);
28
- }
29
- }
30
- if (lastText != null) {
31
- results.push({
32
- type: "text",
33
- text: lastText,
34
- });
35
- lastText = null;
36
- }
37
- return results;
38
- }
39
- }
40
- exports.TextCollapseTransformer = TextCollapseTransformer;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextVisitor = void 0;
4
- const NodeVisitor_js_1 = require("./NodeVisitor.js");
5
- class TextVisitor extends NodeVisitor_js_1.NodeVisitor {
6
- constructor() {
7
- super();
8
- Object.defineProperty(this, "textList", {
9
- enumerable: true,
10
- configurable: true,
11
- writable: true,
12
- value: void 0
13
- });
14
- this.textList = [];
15
- }
16
- text(node) {
17
- this.textList.push(node.text);
18
- super.text(node);
19
- }
20
- video(node) {
21
- this.textList.push(node.alt);
22
- super.video(node);
23
- }
24
- image(node) {
25
- this.textList.push(node.alt);
26
- super.image(node);
27
- }
28
- emoji(node) {
29
- this.textList.push(node.alt);
30
- super.emoji(node);
31
- }
32
- figureImage(node) {
33
- this.textList.push(node.alt);
34
- super.figureImage(node);
35
- }
36
- definitionReference(node) {
37
- this.chooseChildren(node.content);
38
- }
39
- definition(node) {
40
- this.chooseChildren(node.title);
41
- this.textList.push(" (");
42
- this.chooseChildren(node.abbreviation);
43
- this.textList.push("): ");
44
- this.chooseChildren(node.content);
45
- }
46
- toc(node) {
47
- if (node.date) {
48
- this.choose(node.date);
49
- this.textList.push(" ");
50
- }
51
- this.chooseChildren(node.content);
52
- this.textList.push("\n");
53
- this.chooseChildren(node.children);
54
- }
55
- getText() {
56
- return this.textList.join("");
57
- }
58
- }
59
- exports.TextVisitor = TextVisitor;
@@ -1,125 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WhitespaceStretchingTransformer = void 0;
4
- const IdentityTransformer_js_1 = require("./IdentityTransformer.js");
5
- class WhitespaceStretchingTransformer extends IdentityTransformer_js_1.IdentityTransformer {
6
- constructor() {
7
- super();
8
- Object.defineProperty(this, "root", {
9
- enumerable: true,
10
- configurable: true,
11
- writable: true,
12
- value: void 0
13
- });
14
- Object.defineProperty(this, "cursor", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: void 0
19
- });
20
- this.root = {
21
- type: "_block",
22
- content: [],
23
- parent: null,
24
- };
25
- this.cursor = this.root;
26
- }
27
- // deno-lint-ignore require-await
28
- async beforeBlock() {
29
- const parent = this.cursor;
30
- const block = {
31
- type: "_block",
32
- content: [],
33
- parent,
34
- };
35
- parent.content.push(block);
36
- this.cursor = block;
37
- }
38
- // deno-lint-ignore require-await
39
- async afterBlock() {
40
- if (this.cursor.parent) {
41
- this.cursor = this.cursor.parent;
42
- }
43
- }
44
- // deno-lint-ignore require-await
45
- async beforeInline() {
46
- const parent = this.cursor;
47
- const inline = {
48
- type: "_inline",
49
- content: [],
50
- parent,
51
- };
52
- parent.content.push(inline);
53
- this.cursor = inline;
54
- }
55
- // deno-lint-ignore require-await
56
- async afterInline() {
57
- if (this.cursor.parent) {
58
- this.cursor = this.cursor.parent;
59
- }
60
- }
61
- reviewBlock(block) {
62
- const nodes = [];
63
- const visit = (r, level) => {
64
- if (r.type == "text") {
65
- nodes.push({
66
- node: r,
67
- level,
68
- });
69
- }
70
- else if (r.type == "_block") {
71
- this.reviewBlock(r);
72
- nodes.push({ node: null, level });
73
- }
74
- else {
75
- for (const node of r.content) {
76
- visit(node, level + 1);
77
- }
78
- }
79
- };
80
- for (const node of block.content) {
81
- visit(node, 0);
82
- }
83
- for (let i = 0; i < nodes.length; i++) {
84
- const first = nodes[i];
85
- const second = i + 1 < nodes.length
86
- ? nodes[i + 1]
87
- : { node: null, level: 0 };
88
- // No use acting on a dead node
89
- if (!first.node || !second.node) {
90
- continue;
91
- }
92
- // Interesting things only happen on differing levels
93
- if (first.level == second.level) {
94
- continue;
95
- }
96
- if (first.level < second.level) {
97
- if (second.node.text.startsWith(" ")) {
98
- second.node.text = second.node.text.slice(1);
99
- first.node.text += " ";
100
- }
101
- }
102
- else if (first.level > second.level) {
103
- if (first.node.text.endsWith(" ")) {
104
- first.node.text = first.node.text.slice(0, -1);
105
- second.node.text = ` ${second.node.text}`;
106
- }
107
- }
108
- }
109
- }
110
- // deno-lint-ignore require-await
111
- async text(node) {
112
- const replacement = {
113
- type: "text",
114
- text: `${node.text}`,
115
- };
116
- this.cursor.content.push(replacement);
117
- return replacement;
118
- }
119
- async transform(node) {
120
- const result = await super.transform(node);
121
- this.reviewBlock(this.root);
122
- return result;
123
- }
124
- }
125
- exports.WhitespaceStretchingTransformer = WhitespaceStretchingTransformer;