@yozora/tokenizer-html-block 1.3.0 → 2.0.0-alpha.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/lib/cjs/index.js CHANGED
@@ -2,20 +2,114 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ast = require('@yozora/ast');
6
5
  var character = require('@yozora/character');
7
6
  var coreTokenizer = require('@yozora/core-tokenizer');
7
+ var ast = require('@yozora/ast');
8
+
9
+ function eatHTMLAttribute(nodePoints, startIndex, endIndex) {
10
+ let i = coreTokenizer.eatOptionalWhitespaces(nodePoints, startIndex, endIndex);
11
+ if (i <= startIndex || i >= endIndex)
12
+ return null;
13
+ const attrNameStartIndex = i;
14
+ let c = nodePoints[i].codePoint;
15
+ if (!character.isAsciiLetter(c) && c !== character.AsciiCodePoint.UNDERSCORE && c !== character.AsciiCodePoint.COLON)
16
+ return null;
17
+ for (i = attrNameStartIndex + 1; i < endIndex; ++i) {
18
+ c = nodePoints[i].codePoint;
19
+ if (character.isAsciiLetter(c) ||
20
+ character.isAsciiDigitCharacter(c) ||
21
+ c === character.AsciiCodePoint.UNDERSCORE ||
22
+ c === character.AsciiCodePoint.DOT ||
23
+ c === character.AsciiCodePoint.COLON ||
24
+ c === character.AsciiCodePoint.MINUS_SIGN)
25
+ continue;
26
+ break;
27
+ }
28
+ const attrNameEndIndex = i;
29
+ const attribute = {
30
+ name: {
31
+ startIndex: attrNameStartIndex,
32
+ endIndex: attrNameEndIndex,
33
+ },
34
+ };
35
+ i = coreTokenizer.eatOptionalWhitespaces(nodePoints, attrNameEndIndex, endIndex);
36
+ if (i < endIndex && nodePoints[i].codePoint === character.AsciiCodePoint.EQUALS_SIGN) {
37
+ i = coreTokenizer.eatOptionalWhitespaces(nodePoints, i + 1, endIndex);
38
+ if (i < endIndex) {
39
+ const mark = nodePoints[i].codePoint;
40
+ switch (mark) {
41
+ case character.AsciiCodePoint.DOUBLE_QUOTE: {
42
+ const attrValueStartIndex = i + 1;
43
+ for (i = attrValueStartIndex; i < endIndex; ++i) {
44
+ c = nodePoints[i].codePoint;
45
+ if (c === character.AsciiCodePoint.DOUBLE_QUOTE)
46
+ break;
47
+ }
48
+ const attrValueEndIndex = i;
49
+ if (i < endIndex && nodePoints[i].codePoint === character.AsciiCodePoint.DOUBLE_QUOTE) {
50
+ attribute.value = {
51
+ startIndex: attrValueStartIndex,
52
+ endIndex: attrValueEndIndex,
53
+ };
54
+ i += 1;
55
+ }
56
+ break;
57
+ }
58
+ case character.AsciiCodePoint.SINGLE_QUOTE: {
59
+ const attrValueStartIndex = i + 1;
60
+ for (i = attrValueStartIndex; i < endIndex; ++i) {
61
+ c = nodePoints[i].codePoint;
62
+ if (c === character.AsciiCodePoint.SINGLE_QUOTE)
63
+ break;
64
+ }
65
+ const attrValueEndIndex = i;
66
+ if (i < endIndex && nodePoints[i].codePoint === character.AsciiCodePoint.SINGLE_QUOTE) {
67
+ attribute.value = {
68
+ startIndex: attrValueStartIndex,
69
+ endIndex: attrValueEndIndex,
70
+ };
71
+ i += 1;
72
+ }
73
+ break;
74
+ }
75
+ default: {
76
+ const attrValueStartIndex = i;
77
+ for (; i < endIndex; ++i) {
78
+ c = nodePoints[i].codePoint;
79
+ if (character.isWhitespaceCharacter(c) ||
80
+ c === character.AsciiCodePoint.DOUBLE_QUOTE ||
81
+ c === character.AsciiCodePoint.SINGLE_QUOTE ||
82
+ c === character.AsciiCodePoint.EQUALS_SIGN ||
83
+ c === character.AsciiCodePoint.OPEN_ANGLE ||
84
+ c === character.AsciiCodePoint.CLOSE_ANGLE ||
85
+ c === character.AsciiCodePoint.BACKTICK)
86
+ break;
87
+ }
88
+ const attrValueEndIndex = i;
89
+ if (attrValueEndIndex > attrValueStartIndex) {
90
+ attribute.value = {
91
+ startIndex: attrValueStartIndex,
92
+ endIndex: attrValueEndIndex,
93
+ };
94
+ }
95
+ break;
96
+ }
97
+ }
98
+ if (attribute.value != null) {
99
+ return { attribute, nextIndex: i };
100
+ }
101
+ }
102
+ }
103
+ return { attribute, nextIndex: attrNameEndIndex };
104
+ }
8
105
 
9
106
  function eatHTMLTagName(nodePoints, startIndex, endIndex) {
10
- if (startIndex >= endIndex ||
11
- !character.isAsciiLetter(nodePoints[startIndex].codePoint))
107
+ if (startIndex >= endIndex || !character.isAsciiLetter(nodePoints[startIndex].codePoint))
12
108
  return null;
13
109
  let i = startIndex;
14
110
  for (; i < endIndex; ++i) {
15
111
  const c = nodePoints[i].codePoint;
16
- if (character.isAsciiLetter(c) ||
17
- character.isAsciiDigitCharacter(c) ||
18
- c === character.AsciiCodePoint.MINUS_SIGN)
112
+ if (character.isAsciiLetter(c) || character.isAsciiDigitCharacter(c) || c === character.AsciiCodePoint.MINUS_SIGN)
19
113
  continue;
20
114
  return i;
21
115
  }
@@ -211,107 +305,6 @@ function eatStartCondition6(nodePoints, startIndex, endIndex, tagName) {
211
305
  return null;
212
306
  }
213
307
 
214
- function eatHTMLAttribute(nodePoints, startIndex, endIndex) {
215
- let i = coreTokenizer.eatOptionalWhitespaces(nodePoints, startIndex, endIndex);
216
- if (i <= startIndex || i >= endIndex)
217
- return null;
218
- const attrNameStartIndex = i;
219
- let c = nodePoints[i].codePoint;
220
- if (!character.isAsciiLetter(c) &&
221
- c !== character.AsciiCodePoint.UNDERSCORE &&
222
- c !== character.AsciiCodePoint.COLON)
223
- return null;
224
- for (i = attrNameStartIndex + 1; i < endIndex; ++i) {
225
- c = nodePoints[i].codePoint;
226
- if (character.isAsciiLetter(c) ||
227
- character.isAsciiDigitCharacter(c) ||
228
- c === character.AsciiCodePoint.UNDERSCORE ||
229
- c === character.AsciiCodePoint.DOT ||
230
- c === character.AsciiCodePoint.COLON ||
231
- c === character.AsciiCodePoint.MINUS_SIGN)
232
- continue;
233
- break;
234
- }
235
- const attrNameEndIndex = i;
236
- const attribute = {
237
- name: {
238
- startIndex: attrNameStartIndex,
239
- endIndex: attrNameEndIndex,
240
- },
241
- };
242
- i = coreTokenizer.eatOptionalWhitespaces(nodePoints, attrNameEndIndex, endIndex);
243
- if (i < endIndex && nodePoints[i].codePoint === character.AsciiCodePoint.EQUALS_SIGN) {
244
- i = coreTokenizer.eatOptionalWhitespaces(nodePoints, i + 1, endIndex);
245
- if (i < endIndex) {
246
- const mark = nodePoints[i].codePoint;
247
- switch (mark) {
248
- case character.AsciiCodePoint.DOUBLE_QUOTE: {
249
- const attrValueStartIndex = i + 1;
250
- for (i = attrValueStartIndex; i < endIndex; ++i) {
251
- c = nodePoints[i].codePoint;
252
- if (c === character.AsciiCodePoint.DOUBLE_QUOTE)
253
- break;
254
- }
255
- const attrValueEndIndex = i;
256
- if (i < endIndex &&
257
- nodePoints[i].codePoint === character.AsciiCodePoint.DOUBLE_QUOTE) {
258
- attribute.value = {
259
- startIndex: attrValueStartIndex,
260
- endIndex: attrValueEndIndex,
261
- };
262
- i += 1;
263
- }
264
- break;
265
- }
266
- case character.AsciiCodePoint.SINGLE_QUOTE: {
267
- const attrValueStartIndex = i + 1;
268
- for (i = attrValueStartIndex; i < endIndex; ++i) {
269
- c = nodePoints[i].codePoint;
270
- if (c === character.AsciiCodePoint.SINGLE_QUOTE)
271
- break;
272
- }
273
- const attrValueEndIndex = i;
274
- if (i < endIndex &&
275
- nodePoints[i].codePoint === character.AsciiCodePoint.SINGLE_QUOTE) {
276
- attribute.value = {
277
- startIndex: attrValueStartIndex,
278
- endIndex: attrValueEndIndex,
279
- };
280
- i += 1;
281
- }
282
- break;
283
- }
284
- default: {
285
- const attrValueStartIndex = i;
286
- for (; i < endIndex; ++i) {
287
- c = nodePoints[i].codePoint;
288
- if (character.isWhitespaceCharacter(c) ||
289
- c === character.AsciiCodePoint.DOUBLE_QUOTE ||
290
- c === character.AsciiCodePoint.SINGLE_QUOTE ||
291
- c === character.AsciiCodePoint.EQUALS_SIGN ||
292
- c === character.AsciiCodePoint.OPEN_ANGLE ||
293
- c === character.AsciiCodePoint.CLOSE_ANGLE ||
294
- c === character.AsciiCodePoint.BACKTICK)
295
- break;
296
- }
297
- const attrValueEndIndex = i;
298
- if (attrValueEndIndex > attrValueStartIndex) {
299
- attribute.value = {
300
- startIndex: attrValueStartIndex,
301
- endIndex: attrValueEndIndex,
302
- };
303
- }
304
- break;
305
- }
306
- }
307
- if (attribute.value != null) {
308
- return { attribute, nextIndex: i };
309
- }
310
- }
311
- }
312
- return { attribute, nextIndex: attrNameEndIndex };
313
- }
314
-
315
308
  const excludedTags = ['pre', 'script', 'style'];
316
309
  function eatStartCondition7(nodePoints, startIndex, endIndex, tagName, potentialOpenTag) {
317
310
  if (excludedTags.includes(tagName) || startIndex >= endIndex)
@@ -342,33 +335,28 @@ function eatStartCondition7(nodePoints, startIndex, endIndex, tagName, potential
342
335
  return endIndex;
343
336
  }
344
337
 
345
- const uniqueName = '@yozora/tokenizer-html-block';
346
-
347
- class HtmlBlockTokenizer extends coreTokenizer.BaseBlockTokenizer {
348
- constructor(props = {}) {
349
- var _a, _b;
350
- super({
351
- name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
352
- priority: (_b = props.priority) !== null && _b !== void 0 ? _b : coreTokenizer.TokenizerPriority.ATOMIC,
353
- });
354
- this.isContainingBlock = false;
355
- }
356
- eatOpener(line) {
338
+ const match = function () {
339
+ return {
340
+ isContainingBlock: false,
341
+ eatOpener,
342
+ eatAndInterruptPreviousSibling,
343
+ eatContinuationText,
344
+ };
345
+ function eatOpener(line) {
357
346
  if (line.countOfPrecedeSpaces >= 4)
358
347
  return null;
359
348
  const { nodePoints, startIndex, endIndex, firstNonWhitespaceIndex } = line;
360
349
  if (firstNonWhitespaceIndex >= endIndex ||
361
- nodePoints[firstNonWhitespaceIndex].codePoint !==
362
- character.AsciiCodePoint.OPEN_ANGLE)
350
+ nodePoints[firstNonWhitespaceIndex].codePoint !== character.AsciiCodePoint.OPEN_ANGLE)
363
351
  return null;
364
352
  const i = firstNonWhitespaceIndex + 1;
365
- const startResult = this.eatStartCondition(nodePoints, i, endIndex);
353
+ const startResult = eatStartCondition(nodePoints, i, endIndex);
366
354
  if (startResult == null)
367
355
  return null;
368
356
  const { condition } = startResult;
369
357
  let saturated = false;
370
358
  if (condition !== 6 && condition !== 7) {
371
- const endResult = this.eatEndCondition(nodePoints, startResult.nextIndex, endIndex, condition);
359
+ const endResult = eatEndCondition(nodePoints, startResult.nextIndex, endIndex, condition);
372
360
  if (endResult != null)
373
361
  saturated = true;
374
362
  }
@@ -384,8 +372,8 @@ class HtmlBlockTokenizer extends coreTokenizer.BaseBlockTokenizer {
384
372
  };
385
373
  return { token, nextIndex, saturated };
386
374
  }
387
- eatAndInterruptPreviousSibling(line, prevSiblingToken) {
388
- const result = this.eatOpener(line);
375
+ function eatAndInterruptPreviousSibling(line, prevSiblingToken) {
376
+ const result = eatOpener(line);
389
377
  if (result == null || result.token.condition === 7)
390
378
  return null;
391
379
  const { token, nextIndex } = result;
@@ -395,9 +383,9 @@ class HtmlBlockTokenizer extends coreTokenizer.BaseBlockTokenizer {
395
383
  remainingSibling: prevSiblingToken,
396
384
  };
397
385
  }
398
- eatContinuationText(line, token) {
386
+ function eatContinuationText(line, token) {
399
387
  const { nodePoints, endIndex, firstNonWhitespaceIndex } = line;
400
- const nextIndex = this.eatEndCondition(nodePoints, firstNonWhitespaceIndex, endIndex, token.condition);
388
+ const nextIndex = eatEndCondition(nodePoints, firstNonWhitespaceIndex, endIndex, token.condition);
401
389
  if (nextIndex === -1)
402
390
  return { status: 'notMatched' };
403
391
  token.lines.push(line);
@@ -405,15 +393,7 @@ class HtmlBlockTokenizer extends coreTokenizer.BaseBlockTokenizer {
405
393
  return { status: 'closing', nextIndex: endIndex };
406
394
  return { status: 'opening', nextIndex: endIndex };
407
395
  }
408
- parseBlock(token) {
409
- const contents = coreTokenizer.mergeContentLinesFaithfully(token.lines);
410
- const node = {
411
- type: 'html',
412
- value: character.calcStringFromNodePoints(contents),
413
- };
414
- return node;
415
- }
416
- eatStartCondition(nodePoints, startIndex, endIndex) {
396
+ function eatStartCondition(nodePoints, startIndex, endIndex) {
417
397
  let nextIndex = null;
418
398
  if (startIndex >= endIndex)
419
399
  return null;
@@ -469,7 +449,7 @@ class HtmlBlockTokenizer extends coreTokenizer.BaseBlockTokenizer {
469
449
  return { nextIndex, condition: 7 };
470
450
  return null;
471
451
  }
472
- eatEndCondition(nodePoints, startIndex, endIndex, condition) {
452
+ function eatEndCondition(nodePoints, startIndex, endIndex, condition) {
473
453
  switch (condition) {
474
454
  case 1: {
475
455
  const nextIndex = eatEndCondition1(nodePoints, startIndex, endIndex);
@@ -498,10 +478,39 @@ class HtmlBlockTokenizer extends coreTokenizer.BaseBlockTokenizer {
498
478
  }
499
479
  }
500
480
  }
481
+ };
482
+
483
+ const parse = function () {
484
+ return {
485
+ parse: token => {
486
+ const contents = coreTokenizer.mergeContentLinesFaithfully(token.lines);
487
+ const node = {
488
+ type: 'html',
489
+ value: character.calcStringFromNodePoints(contents),
490
+ };
491
+ return node;
492
+ },
493
+ };
494
+ };
495
+
496
+ const uniqueName = '@yozora/tokenizer-html-block';
497
+
498
+ class HtmlBlockTokenizer extends coreTokenizer.BaseBlockTokenizer {
499
+ constructor(props = {}) {
500
+ var _a, _b;
501
+ super({
502
+ name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
503
+ priority: (_b = props.priority) !== null && _b !== void 0 ? _b : coreTokenizer.TokenizerPriority.ATOMIC,
504
+ });
505
+ this.match = match;
506
+ this.parse = parse;
507
+ }
501
508
  }
502
509
 
503
510
  exports.HtmlBlockTokenizer = HtmlBlockTokenizer;
504
511
  exports.HtmlBlockTokenizerName = uniqueName;
505
- exports['default'] = HtmlBlockTokenizer;
512
+ exports["default"] = HtmlBlockTokenizer;
506
513
  exports.eatHTMLAttribute = eatHTMLAttribute;
507
514
  exports.eatHTMLTagName = eatHTMLTagName;
515
+ exports.htmlBlockMatch = match;
516
+ exports.htmlBlockParse = parse;
package/lib/esm/index.js CHANGED
@@ -1,17 +1,111 @@
1
+ import { isAsciiLetter, AsciiCodePoint, isAsciiDigitCharacter, isWhitespaceCharacter, calcStringFromNodePoints, isAsciiUpperLetter } from '@yozora/character';
2
+ import { eatOptionalWhitespaces, calcStartYastNodePoint, calcEndYastNodePoint, mergeContentLinesFaithfully, BaseBlockTokenizer, TokenizerPriority } from '@yozora/core-tokenizer';
1
3
  import { HtmlType } from '@yozora/ast';
2
- import { isAsciiLetter, isAsciiDigitCharacter, AsciiCodePoint, isWhitespaceCharacter, calcStringFromNodePoints, isAsciiUpperLetter } from '@yozora/character';
3
- import { eatOptionalWhitespaces, BaseBlockTokenizer, TokenizerPriority, calcStartYastNodePoint, calcEndYastNodePoint, mergeContentLinesFaithfully } from '@yozora/core-tokenizer';
4
+
5
+ function eatHTMLAttribute(nodePoints, startIndex, endIndex) {
6
+ let i = eatOptionalWhitespaces(nodePoints, startIndex, endIndex);
7
+ if (i <= startIndex || i >= endIndex)
8
+ return null;
9
+ const attrNameStartIndex = i;
10
+ let c = nodePoints[i].codePoint;
11
+ if (!isAsciiLetter(c) && c !== AsciiCodePoint.UNDERSCORE && c !== AsciiCodePoint.COLON)
12
+ return null;
13
+ for (i = attrNameStartIndex + 1; i < endIndex; ++i) {
14
+ c = nodePoints[i].codePoint;
15
+ if (isAsciiLetter(c) ||
16
+ isAsciiDigitCharacter(c) ||
17
+ c === AsciiCodePoint.UNDERSCORE ||
18
+ c === AsciiCodePoint.DOT ||
19
+ c === AsciiCodePoint.COLON ||
20
+ c === AsciiCodePoint.MINUS_SIGN)
21
+ continue;
22
+ break;
23
+ }
24
+ const attrNameEndIndex = i;
25
+ const attribute = {
26
+ name: {
27
+ startIndex: attrNameStartIndex,
28
+ endIndex: attrNameEndIndex,
29
+ },
30
+ };
31
+ i = eatOptionalWhitespaces(nodePoints, attrNameEndIndex, endIndex);
32
+ if (i < endIndex && nodePoints[i].codePoint === AsciiCodePoint.EQUALS_SIGN) {
33
+ i = eatOptionalWhitespaces(nodePoints, i + 1, endIndex);
34
+ if (i < endIndex) {
35
+ const mark = nodePoints[i].codePoint;
36
+ switch (mark) {
37
+ case AsciiCodePoint.DOUBLE_QUOTE: {
38
+ const attrValueStartIndex = i + 1;
39
+ for (i = attrValueStartIndex; i < endIndex; ++i) {
40
+ c = nodePoints[i].codePoint;
41
+ if (c === AsciiCodePoint.DOUBLE_QUOTE)
42
+ break;
43
+ }
44
+ const attrValueEndIndex = i;
45
+ if (i < endIndex && nodePoints[i].codePoint === AsciiCodePoint.DOUBLE_QUOTE) {
46
+ attribute.value = {
47
+ startIndex: attrValueStartIndex,
48
+ endIndex: attrValueEndIndex,
49
+ };
50
+ i += 1;
51
+ }
52
+ break;
53
+ }
54
+ case AsciiCodePoint.SINGLE_QUOTE: {
55
+ const attrValueStartIndex = i + 1;
56
+ for (i = attrValueStartIndex; i < endIndex; ++i) {
57
+ c = nodePoints[i].codePoint;
58
+ if (c === AsciiCodePoint.SINGLE_QUOTE)
59
+ break;
60
+ }
61
+ const attrValueEndIndex = i;
62
+ if (i < endIndex && nodePoints[i].codePoint === AsciiCodePoint.SINGLE_QUOTE) {
63
+ attribute.value = {
64
+ startIndex: attrValueStartIndex,
65
+ endIndex: attrValueEndIndex,
66
+ };
67
+ i += 1;
68
+ }
69
+ break;
70
+ }
71
+ default: {
72
+ const attrValueStartIndex = i;
73
+ for (; i < endIndex; ++i) {
74
+ c = nodePoints[i].codePoint;
75
+ if (isWhitespaceCharacter(c) ||
76
+ c === AsciiCodePoint.DOUBLE_QUOTE ||
77
+ c === AsciiCodePoint.SINGLE_QUOTE ||
78
+ c === AsciiCodePoint.EQUALS_SIGN ||
79
+ c === AsciiCodePoint.OPEN_ANGLE ||
80
+ c === AsciiCodePoint.CLOSE_ANGLE ||
81
+ c === AsciiCodePoint.BACKTICK)
82
+ break;
83
+ }
84
+ const attrValueEndIndex = i;
85
+ if (attrValueEndIndex > attrValueStartIndex) {
86
+ attribute.value = {
87
+ startIndex: attrValueStartIndex,
88
+ endIndex: attrValueEndIndex,
89
+ };
90
+ }
91
+ break;
92
+ }
93
+ }
94
+ if (attribute.value != null) {
95
+ return { attribute, nextIndex: i };
96
+ }
97
+ }
98
+ }
99
+ return { attribute, nextIndex: attrNameEndIndex };
100
+ }
4
101
 
5
102
  function eatHTMLTagName(nodePoints, startIndex, endIndex) {
6
- if (startIndex >= endIndex ||
7
- !isAsciiLetter(nodePoints[startIndex].codePoint))
103
+ if (startIndex >= endIndex || !isAsciiLetter(nodePoints[startIndex].codePoint))
8
104
  return null;
9
105
  let i = startIndex;
10
106
  for (; i < endIndex; ++i) {
11
107
  const c = nodePoints[i].codePoint;
12
- if (isAsciiLetter(c) ||
13
- isAsciiDigitCharacter(c) ||
14
- c === AsciiCodePoint.MINUS_SIGN)
108
+ if (isAsciiLetter(c) || isAsciiDigitCharacter(c) || c === AsciiCodePoint.MINUS_SIGN)
15
109
  continue;
16
110
  return i;
17
111
  }
@@ -207,107 +301,6 @@ function eatStartCondition6(nodePoints, startIndex, endIndex, tagName) {
207
301
  return null;
208
302
  }
209
303
 
210
- function eatHTMLAttribute(nodePoints, startIndex, endIndex) {
211
- let i = eatOptionalWhitespaces(nodePoints, startIndex, endIndex);
212
- if (i <= startIndex || i >= endIndex)
213
- return null;
214
- const attrNameStartIndex = i;
215
- let c = nodePoints[i].codePoint;
216
- if (!isAsciiLetter(c) &&
217
- c !== AsciiCodePoint.UNDERSCORE &&
218
- c !== AsciiCodePoint.COLON)
219
- return null;
220
- for (i = attrNameStartIndex + 1; i < endIndex; ++i) {
221
- c = nodePoints[i].codePoint;
222
- if (isAsciiLetter(c) ||
223
- isAsciiDigitCharacter(c) ||
224
- c === AsciiCodePoint.UNDERSCORE ||
225
- c === AsciiCodePoint.DOT ||
226
- c === AsciiCodePoint.COLON ||
227
- c === AsciiCodePoint.MINUS_SIGN)
228
- continue;
229
- break;
230
- }
231
- const attrNameEndIndex = i;
232
- const attribute = {
233
- name: {
234
- startIndex: attrNameStartIndex,
235
- endIndex: attrNameEndIndex,
236
- },
237
- };
238
- i = eatOptionalWhitespaces(nodePoints, attrNameEndIndex, endIndex);
239
- if (i < endIndex && nodePoints[i].codePoint === AsciiCodePoint.EQUALS_SIGN) {
240
- i = eatOptionalWhitespaces(nodePoints, i + 1, endIndex);
241
- if (i < endIndex) {
242
- const mark = nodePoints[i].codePoint;
243
- switch (mark) {
244
- case AsciiCodePoint.DOUBLE_QUOTE: {
245
- const attrValueStartIndex = i + 1;
246
- for (i = attrValueStartIndex; i < endIndex; ++i) {
247
- c = nodePoints[i].codePoint;
248
- if (c === AsciiCodePoint.DOUBLE_QUOTE)
249
- break;
250
- }
251
- const attrValueEndIndex = i;
252
- if (i < endIndex &&
253
- nodePoints[i].codePoint === AsciiCodePoint.DOUBLE_QUOTE) {
254
- attribute.value = {
255
- startIndex: attrValueStartIndex,
256
- endIndex: attrValueEndIndex,
257
- };
258
- i += 1;
259
- }
260
- break;
261
- }
262
- case AsciiCodePoint.SINGLE_QUOTE: {
263
- const attrValueStartIndex = i + 1;
264
- for (i = attrValueStartIndex; i < endIndex; ++i) {
265
- c = nodePoints[i].codePoint;
266
- if (c === AsciiCodePoint.SINGLE_QUOTE)
267
- break;
268
- }
269
- const attrValueEndIndex = i;
270
- if (i < endIndex &&
271
- nodePoints[i].codePoint === AsciiCodePoint.SINGLE_QUOTE) {
272
- attribute.value = {
273
- startIndex: attrValueStartIndex,
274
- endIndex: attrValueEndIndex,
275
- };
276
- i += 1;
277
- }
278
- break;
279
- }
280
- default: {
281
- const attrValueStartIndex = i;
282
- for (; i < endIndex; ++i) {
283
- c = nodePoints[i].codePoint;
284
- if (isWhitespaceCharacter(c) ||
285
- c === AsciiCodePoint.DOUBLE_QUOTE ||
286
- c === AsciiCodePoint.SINGLE_QUOTE ||
287
- c === AsciiCodePoint.EQUALS_SIGN ||
288
- c === AsciiCodePoint.OPEN_ANGLE ||
289
- c === AsciiCodePoint.CLOSE_ANGLE ||
290
- c === AsciiCodePoint.BACKTICK)
291
- break;
292
- }
293
- const attrValueEndIndex = i;
294
- if (attrValueEndIndex > attrValueStartIndex) {
295
- attribute.value = {
296
- startIndex: attrValueStartIndex,
297
- endIndex: attrValueEndIndex,
298
- };
299
- }
300
- break;
301
- }
302
- }
303
- if (attribute.value != null) {
304
- return { attribute, nextIndex: i };
305
- }
306
- }
307
- }
308
- return { attribute, nextIndex: attrNameEndIndex };
309
- }
310
-
311
304
  const excludedTags = ['pre', 'script', 'style'];
312
305
  function eatStartCondition7(nodePoints, startIndex, endIndex, tagName, potentialOpenTag) {
313
306
  if (excludedTags.includes(tagName) || startIndex >= endIndex)
@@ -338,33 +331,28 @@ function eatStartCondition7(nodePoints, startIndex, endIndex, tagName, potential
338
331
  return endIndex;
339
332
  }
340
333
 
341
- const uniqueName = '@yozora/tokenizer-html-block';
342
-
343
- class HtmlBlockTokenizer extends BaseBlockTokenizer {
344
- constructor(props = {}) {
345
- var _a, _b;
346
- super({
347
- name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
348
- priority: (_b = props.priority) !== null && _b !== void 0 ? _b : TokenizerPriority.ATOMIC,
349
- });
350
- this.isContainingBlock = false;
351
- }
352
- eatOpener(line) {
334
+ const match = function () {
335
+ return {
336
+ isContainingBlock: false,
337
+ eatOpener,
338
+ eatAndInterruptPreviousSibling,
339
+ eatContinuationText,
340
+ };
341
+ function eatOpener(line) {
353
342
  if (line.countOfPrecedeSpaces >= 4)
354
343
  return null;
355
344
  const { nodePoints, startIndex, endIndex, firstNonWhitespaceIndex } = line;
356
345
  if (firstNonWhitespaceIndex >= endIndex ||
357
- nodePoints[firstNonWhitespaceIndex].codePoint !==
358
- AsciiCodePoint.OPEN_ANGLE)
346
+ nodePoints[firstNonWhitespaceIndex].codePoint !== AsciiCodePoint.OPEN_ANGLE)
359
347
  return null;
360
348
  const i = firstNonWhitespaceIndex + 1;
361
- const startResult = this.eatStartCondition(nodePoints, i, endIndex);
349
+ const startResult = eatStartCondition(nodePoints, i, endIndex);
362
350
  if (startResult == null)
363
351
  return null;
364
352
  const { condition } = startResult;
365
353
  let saturated = false;
366
354
  if (condition !== 6 && condition !== 7) {
367
- const endResult = this.eatEndCondition(nodePoints, startResult.nextIndex, endIndex, condition);
355
+ const endResult = eatEndCondition(nodePoints, startResult.nextIndex, endIndex, condition);
368
356
  if (endResult != null)
369
357
  saturated = true;
370
358
  }
@@ -380,8 +368,8 @@ class HtmlBlockTokenizer extends BaseBlockTokenizer {
380
368
  };
381
369
  return { token, nextIndex, saturated };
382
370
  }
383
- eatAndInterruptPreviousSibling(line, prevSiblingToken) {
384
- const result = this.eatOpener(line);
371
+ function eatAndInterruptPreviousSibling(line, prevSiblingToken) {
372
+ const result = eatOpener(line);
385
373
  if (result == null || result.token.condition === 7)
386
374
  return null;
387
375
  const { token, nextIndex } = result;
@@ -391,9 +379,9 @@ class HtmlBlockTokenizer extends BaseBlockTokenizer {
391
379
  remainingSibling: prevSiblingToken,
392
380
  };
393
381
  }
394
- eatContinuationText(line, token) {
382
+ function eatContinuationText(line, token) {
395
383
  const { nodePoints, endIndex, firstNonWhitespaceIndex } = line;
396
- const nextIndex = this.eatEndCondition(nodePoints, firstNonWhitespaceIndex, endIndex, token.condition);
384
+ const nextIndex = eatEndCondition(nodePoints, firstNonWhitespaceIndex, endIndex, token.condition);
397
385
  if (nextIndex === -1)
398
386
  return { status: 'notMatched' };
399
387
  token.lines.push(line);
@@ -401,15 +389,7 @@ class HtmlBlockTokenizer extends BaseBlockTokenizer {
401
389
  return { status: 'closing', nextIndex: endIndex };
402
390
  return { status: 'opening', nextIndex: endIndex };
403
391
  }
404
- parseBlock(token) {
405
- const contents = mergeContentLinesFaithfully(token.lines);
406
- const node = {
407
- type: 'html',
408
- value: calcStringFromNodePoints(contents),
409
- };
410
- return node;
411
- }
412
- eatStartCondition(nodePoints, startIndex, endIndex) {
392
+ function eatStartCondition(nodePoints, startIndex, endIndex) {
413
393
  let nextIndex = null;
414
394
  if (startIndex >= endIndex)
415
395
  return null;
@@ -465,7 +445,7 @@ class HtmlBlockTokenizer extends BaseBlockTokenizer {
465
445
  return { nextIndex, condition: 7 };
466
446
  return null;
467
447
  }
468
- eatEndCondition(nodePoints, startIndex, endIndex, condition) {
448
+ function eatEndCondition(nodePoints, startIndex, endIndex, condition) {
469
449
  switch (condition) {
470
450
  case 1: {
471
451
  const nextIndex = eatEndCondition1(nodePoints, startIndex, endIndex);
@@ -494,6 +474,33 @@ class HtmlBlockTokenizer extends BaseBlockTokenizer {
494
474
  }
495
475
  }
496
476
  }
477
+ };
478
+
479
+ const parse = function () {
480
+ return {
481
+ parse: token => {
482
+ const contents = mergeContentLinesFaithfully(token.lines);
483
+ const node = {
484
+ type: 'html',
485
+ value: calcStringFromNodePoints(contents),
486
+ };
487
+ return node;
488
+ },
489
+ };
490
+ };
491
+
492
+ const uniqueName = '@yozora/tokenizer-html-block';
493
+
494
+ class HtmlBlockTokenizer extends BaseBlockTokenizer {
495
+ constructor(props = {}) {
496
+ var _a, _b;
497
+ super({
498
+ name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
499
+ priority: (_b = props.priority) !== null && _b !== void 0 ? _b : TokenizerPriority.ATOMIC,
500
+ });
501
+ this.match = match;
502
+ this.parse = parse;
503
+ }
497
504
  }
498
505
 
499
- export { HtmlBlockTokenizer, uniqueName as HtmlBlockTokenizerName, HtmlBlockTokenizer as default, eatHTMLAttribute, eatHTMLTagName };
506
+ export { HtmlBlockTokenizer, uniqueName as HtmlBlockTokenizerName, HtmlBlockTokenizer as default, eatHTMLAttribute, eatHTMLTagName, match as htmlBlockMatch, parse as htmlBlockParse };
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * Eat block html start condition 1:
4
4
  *
@@ -11,7 +11,7 @@ import type { NodePoint } from '@yozora/character';
11
11
  * @param endIndex
12
12
  * @see https://github.github.com/gfm/#start-condition
13
13
  */
14
- export declare function eatStartCondition1(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number, tagName: string): number | null;
14
+ export declare function eatStartCondition1(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, tagName: string): number | null;
15
15
  /**
16
16
  * Eat block html end condition 1:
17
17
  *
@@ -23,4 +23,4 @@ export declare function eatStartCondition1(nodePoints: ReadonlyArray<NodePoint>,
23
23
  * @param endIndex
24
24
  * @see https://github.github.com/gfm/#start-condition
25
25
  */
26
- export declare function eatEndCondition1(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
26
+ export declare function eatEndCondition1(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * Eat block html start condition 2:
4
4
  *
@@ -9,7 +9,7 @@ import type { NodePoint } from '@yozora/character';
9
9
  * @param endIndex
10
10
  * @see https://github.github.com/gfm/#start-condition
11
11
  */
12
- export declare function eatStartCondition2(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
12
+ export declare function eatStartCondition2(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
13
  /**
14
14
  * Eat block html end condition 2:
15
15
  *
@@ -20,4 +20,4 @@ export declare function eatStartCondition2(nodePoints: ReadonlyArray<NodePoint>,
20
20
  * @param endIndex
21
21
  * @see https://github.github.com/gfm/#start-condition
22
22
  */
23
- export declare function eatEndCondition2(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
23
+ export declare function eatEndCondition2(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * Eat block html start condition 3:
4
4
  *
@@ -9,7 +9,7 @@ import type { NodePoint } from '@yozora/character';
9
9
  * @param endIndex
10
10
  * @see https://github.github.com/gfm/#start-condition
11
11
  */
12
- export declare function eatStartCondition3(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
12
+ export declare function eatStartCondition3(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
13
  /**
14
14
  * Eat block html end condition 3:
15
15
  *
@@ -20,4 +20,4 @@ export declare function eatStartCondition3(nodePoints: ReadonlyArray<NodePoint>,
20
20
  * @param endIndex
21
21
  * @see https://github.github.com/gfm/#start-condition
22
22
  */
23
- export declare function eatEndCondition3(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
23
+ export declare function eatEndCondition3(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * Eat block html start condition 4:
4
4
  *
@@ -9,7 +9,7 @@ import type { NodePoint } from '@yozora/character';
9
9
  * @param endIndex
10
10
  * @see https://github.github.com/gfm/#start-condition
11
11
  */
12
- export declare function eatStartCondition4(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
12
+ export declare function eatStartCondition4(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
13
  /**
14
14
  * Eat block html end condition 4:
15
15
  *
@@ -20,4 +20,4 @@ export declare function eatStartCondition4(nodePoints: ReadonlyArray<NodePoint>,
20
20
  * @param endIndex
21
21
  * @see https://github.github.com/gfm/#start-condition
22
22
  */
23
- export declare function eatEndCondition4(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
23
+ export declare function eatEndCondition4(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * Eat block html start condition 5:
4
4
  *
@@ -9,7 +9,7 @@ import type { NodePoint } from '@yozora/character';
9
9
  * @param endIndex
10
10
  * @see https://github.github.com/gfm/#start-condition
11
11
  */
12
- export declare function eatStartCondition5(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
12
+ export declare function eatStartCondition5(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
13
  /**
14
14
  * Eat block html end condition 5:
15
15
  *
@@ -20,4 +20,4 @@ export declare function eatStartCondition5(nodePoints: ReadonlyArray<NodePoint>,
20
20
  * @param endIndex
21
21
  * @see https://github.github.com/gfm/#start-condition
22
22
  */
23
- export declare function eatEndCondition5(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
23
+ export declare function eatEndCondition5(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * Eat block html start condition 6:
4
4
  *
@@ -19,4 +19,4 @@ import type { NodePoint } from '@yozora/character';
19
19
  * @param endIndex
20
20
  * @see https://github.github.com/gfm/#start-condition
21
21
  */
22
- export declare function eatStartCondition6(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number, tagName: string): number | null;
22
+ export declare function eatStartCondition6(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, tagName: string): number | null;
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * Eat block html start condition 7:
4
4
  *
@@ -11,4 +11,4 @@ import type { NodePoint } from '@yozora/character';
11
11
  * @param endIndex
12
12
  * @see https://github.github.com/gfm/#start-condition
13
13
  */
14
- export declare function eatStartCondition7(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number, tagName: string, potentialOpenTag: boolean): number | null;
14
+ export declare function eatStartCondition7(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, tagName: string, potentialOpenTag: boolean): number | null;
@@ -1,7 +1,7 @@
1
- import { HtmlBlockTokenizer } from './tokenizer';
2
1
  export * from './util/eat-html-attribute';
3
2
  export * from './util/eat-html-tagname';
4
- export { HtmlBlockTokenizer } from './tokenizer';
3
+ export { match as htmlBlockMatch } from './match';
4
+ export { parse as htmlBlockParse } from './parse';
5
+ export { HtmlBlockTokenizer, HtmlBlockTokenizer as default } from './tokenizer';
5
6
  export { uniqueName as HtmlBlockTokenizerName } from './types';
6
- export type { Token as HtmlBlockToken, TokenizerProps as HtmlBlockTokenizerProps, } from './types';
7
- export default HtmlBlockTokenizer;
7
+ export type { IHookContext as IHtmlBlockHookContext, IToken as IHtmlBlockToken, ITokenizerProps as IHtmlBlockTokenizerProps, } from './types';
@@ -0,0 +1,10 @@
1
+ import type { IMatchBlockHookCreator } from '@yozora/core-tokenizer';
2
+ import type { IHookContext, IToken, T } from './types';
3
+ /**
4
+ * An HTML block is a group of lines that is treated as raw HTML (and will not
5
+ * be escaped in HTML output).
6
+ *
7
+ * @see https://github.com/syntax-tree/mdast#html
8
+ * @see https://github.github.com/gfm/#html-blocks
9
+ */
10
+ export declare const match: IMatchBlockHookCreator<T, IToken, IHookContext>;
@@ -0,0 +1,3 @@
1
+ import type { IParseBlockHookCreator } from '@yozora/core-tokenizer';
2
+ import type { IHookContext, INode, IToken, T } from './types';
3
+ export declare const parse: IParseBlockHookCreator<T, IToken, INode, IHookContext>;
@@ -1,57 +1,13 @@
1
- import type { NodePoint } from '@yozora/character';
2
- import type { PhrasingContentLine, ResultOfEatAndInterruptPreviousSibling, ResultOfEatContinuationText, ResultOfEatOpener, ResultOfParse, Tokenizer, TokenizerMatchBlockHook, TokenizerParseBlockHook, YastBlockToken } from '@yozora/core-tokenizer';
1
+ import type { IBlockTokenizer, IMatchBlockHookCreator, IParseBlockHookCreator } from '@yozora/core-tokenizer';
3
2
  import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
4
- import type { HtmlBlockConditionType, Node, T, Token, TokenizerProps } from './types';
3
+ import type { IHookContext, INode, IToken, ITokenizerProps, T } from './types';
5
4
  /**
6
5
  * Lexical Analyzer for HtmlBlock.
7
- *
8
- * An HTML block is a group of lines that is treated as raw HTML (and will not
9
- * be escaped in HTML output).
10
- *
11
6
  * @see https://github.com/syntax-tree/mdast#html
12
7
  * @see https://github.github.com/gfm/#html-blocks
13
8
  */
14
- export declare class HtmlBlockTokenizer extends BaseBlockTokenizer implements Tokenizer, TokenizerMatchBlockHook<T, Token>, TokenizerParseBlockHook<T, Token, Node> {
15
- readonly isContainingBlock = false;
16
- constructor(props?: TokenizerProps);
17
- /**
18
- * @override
19
- * @see TokenizerMatchBlockHook
20
- */
21
- eatOpener(line: Readonly<PhrasingContentLine>): ResultOfEatOpener<T, Token>;
22
- /**
23
- * @override
24
- * @see TokenizerMatchBlockHook
25
- */
26
- eatAndInterruptPreviousSibling(line: Readonly<PhrasingContentLine>, prevSiblingToken: Readonly<YastBlockToken>): ResultOfEatAndInterruptPreviousSibling<T, Token>;
27
- /**
28
- * @override
29
- * @see TokenizerMatchBlockHook
30
- */
31
- eatContinuationText(line: Readonly<PhrasingContentLine>, token: Token): ResultOfEatContinuationText;
32
- /**
33
- * @override
34
- * @see TokenizerParseBlockHook
35
- */
36
- parseBlock(token: Readonly<Token>): ResultOfParse<T, Node>;
37
- /**
38
- * Resolve html block start condition.
39
- *
40
- * @param nodePoints
41
- * @param startIndex
42
- * @param endIndex
43
- */
44
- protected eatStartCondition(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): {
45
- condition: HtmlBlockConditionType;
46
- nextIndex: number;
47
- } | null;
48
- /**
49
- * Resolve html block end condition.
50
- *
51
- * @param nodePoints
52
- * @param startIndex
53
- * @param endIndex
54
- * @param condition
55
- */
56
- protected eatEndCondition(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number, condition: HtmlBlockConditionType): -1 | number | null;
9
+ export declare class HtmlBlockTokenizer extends BaseBlockTokenizer<T, IToken, INode, IHookContext> implements IBlockTokenizer<T, IToken, INode, IHookContext> {
10
+ constructor(props?: ITokenizerProps);
11
+ readonly match: IMatchBlockHookCreator<T, IToken, IHookContext>;
12
+ readonly parse: IParseBlockHookCreator<T, IToken, INode, IHookContext>;
57
13
  }
@@ -1,13 +1,13 @@
1
- import type { Html, HtmlType } from '@yozora/ast';
2
- import type { BaseBlockTokenizerProps, PartialYastBlockToken, PhrasingContentLine } from '@yozora/core-tokenizer';
1
+ import type { HtmlType, IHtml } from '@yozora/ast';
2
+ import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, IPhrasingContentLine, ITokenizer } from '@yozora/core-tokenizer';
3
3
  export declare type T = HtmlType;
4
- export declare type Node = Html;
4
+ export declare type INode = IHtml;
5
5
  export declare const uniqueName = "@yozora/tokenizer-html-block";
6
6
  export declare type HtmlBlockConditionType = 1 | 2 | 3 | 4 | 5 | 6 | 7;
7
7
  /**
8
8
  * Middle state during the whole match and parse phase.
9
9
  */
10
- export interface Token extends PartialYastBlockToken<T> {
10
+ export interface IToken extends IPartialYastBlockToken<T> {
11
11
  /**
12
12
  * Number of conditions defined in GFM:
13
13
  *
@@ -58,6 +58,7 @@ export interface Token extends PartialYastBlockToken<T> {
58
58
  /**
59
59
  * Contents
60
60
  */
61
- lines: Array<Readonly<PhrasingContentLine>>;
61
+ lines: Array<Readonly<IPhrasingContentLine>>;
62
62
  }
63
- export declare type TokenizerProps = Partial<BaseBlockTokenizerProps>;
63
+ export declare type IHookContext = ITokenizer;
64
+ export declare type ITokenizerProps = Partial<IBaseBlockTokenizerProps>;
@@ -1,13 +1,13 @@
1
- import type { NodeInterval, NodePoint } from '@yozora/character';
1
+ import type { INodeInterval, INodePoint } from '@yozora/character';
2
2
  export interface RawHTMLAttribute {
3
3
  /**
4
4
  * Attribute name.
5
5
  */
6
- name: NodeInterval;
6
+ name: INodeInterval;
7
7
  /**
8
8
  * Attribute value.
9
9
  */
10
- value?: NodeInterval;
10
+ value?: INodeInterval;
11
11
  }
12
12
  /**
13
13
  * An attribute consists of whitespace, an attribute name, and an optional
@@ -18,7 +18,7 @@ export interface RawHTMLAttribute {
18
18
  * @param endIndex
19
19
  * @see https://github.github.com/gfm/#attribute
20
20
  */
21
- export declare function eatHTMLAttribute(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): {
21
+ export declare function eatHTMLAttribute(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): {
22
22
  attribute: RawHTMLAttribute;
23
23
  nextIndex: number;
24
24
  } | null;
@@ -1,4 +1,4 @@
1
- import type { NodePoint } from '@yozora/character';
1
+ import type { INodePoint } from '@yozora/character';
2
2
  /**
3
3
  * A tag name consists of an ASCII letter followed by zero or more ASCII
4
4
  * letters, digits, or hyphens (-).
@@ -8,4 +8,4 @@ import type { NodePoint } from '@yozora/character';
8
8
  * @param endIndex
9
9
  * @see https://github.github.com/gfm/#tag-name
10
10
  */
11
- export declare function eatHTMLTagName(nodePoints: ReadonlyArray<NodePoint>, startIndex: number, endIndex: number): number | null;
11
+ export declare function eatHTMLTagName(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yozora/tokenizer-html-block",
3
- "version": "1.3.0",
3
+ "version": "2.0.0-alpha.0",
4
4
  "author": {
5
5
  "name": "guanghechen",
6
6
  "url": "https://github.com/guanghechen/"
@@ -35,9 +35,9 @@
35
35
  "test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
36
36
  },
37
37
  "dependencies": {
38
- "@yozora/ast": "^1.3.0",
39
- "@yozora/character": "^1.3.0",
40
- "@yozora/core-tokenizer": "^1.3.0"
38
+ "@yozora/ast": "^2.0.0-alpha.0",
39
+ "@yozora/character": "^2.0.0-alpha.0",
40
+ "@yozora/core-tokenizer": "^2.0.0-alpha.0"
41
41
  },
42
- "gitHead": "18c9b167004ad97718b2f94f25139f80598cbf7a"
42
+ "gitHead": "0171501339c49ffd02ed16a63447fa20a47a29a7"
43
43
  }