@yozora/tokenizer-html-inline 2.0.0-alpha.1 → 2.0.0-alpha.2
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 +6 -4
- package/lib/esm/index.js +6 -4
- package/package.json +6 -6
package/lib/cjs/index.js
CHANGED
|
@@ -257,13 +257,15 @@ function tryToEatDelimiter(nodePoints, startIndex, endIndex) {
|
|
|
257
257
|
|
|
258
258
|
const parse = function (api) {
|
|
259
259
|
return {
|
|
260
|
-
parse: token => {
|
|
260
|
+
parse: tokens => tokens.map(token => {
|
|
261
261
|
const { startIndex, endIndex } = token;
|
|
262
262
|
const nodePoints = api.getNodePoints();
|
|
263
263
|
const value = character.calcStringFromNodePoints(nodePoints, startIndex, endIndex);
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
264
|
+
const node = api.shouldReservePosition
|
|
265
|
+
? { type: ast.HtmlType, position: api.calcPosition(token), value }
|
|
266
|
+
: { type: ast.HtmlType, value };
|
|
267
|
+
return node;
|
|
268
|
+
}),
|
|
267
269
|
};
|
|
268
270
|
};
|
|
269
271
|
|
package/lib/esm/index.js
CHANGED
|
@@ -253,13 +253,15 @@ function tryToEatDelimiter(nodePoints, startIndex, endIndex) {
|
|
|
253
253
|
|
|
254
254
|
const parse = function (api) {
|
|
255
255
|
return {
|
|
256
|
-
parse: token => {
|
|
256
|
+
parse: tokens => tokens.map(token => {
|
|
257
257
|
const { startIndex, endIndex } = token;
|
|
258
258
|
const nodePoints = api.getNodePoints();
|
|
259
259
|
const value = calcStringFromNodePoints(nodePoints, startIndex, endIndex);
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
const node = api.shouldReservePosition
|
|
261
|
+
? { type: HtmlType, position: api.calcPosition(token), value }
|
|
262
|
+
: { type: HtmlType, value };
|
|
263
|
+
return node;
|
|
264
|
+
}),
|
|
263
265
|
};
|
|
264
266
|
};
|
|
265
267
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-html-inline",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yozora/ast": "^2.0.0-alpha.
|
|
39
|
-
"@yozora/character": "^2.0.0-alpha.
|
|
40
|
-
"@yozora/core-tokenizer": "^2.0.0-alpha.
|
|
41
|
-
"@yozora/tokenizer-html-block": "^2.0.0-alpha.
|
|
38
|
+
"@yozora/ast": "^2.0.0-alpha.2",
|
|
39
|
+
"@yozora/character": "^2.0.0-alpha.2",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.0-alpha.2",
|
|
41
|
+
"@yozora/tokenizer-html-block": "^2.0.0-alpha.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "da59d85520455c59a117a35032ef1a035c10ea21"
|
|
44
44
|
}
|