@yozora/tokenizer-link 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 +7 -9
- package/lib/esm/index.js +7 -9
- package/package.json +5 -5
package/lib/cjs/index.js
CHANGED
|
@@ -241,7 +241,7 @@ const match = function (api) {
|
|
|
241
241
|
|
|
242
242
|
const parse = function (api) {
|
|
243
243
|
return {
|
|
244
|
-
parse: (token
|
|
244
|
+
parse: tokens => tokens.map(token => {
|
|
245
245
|
const nodePoints = api.getNodePoints();
|
|
246
246
|
let url = '';
|
|
247
247
|
if (token.destinationContent != null) {
|
|
@@ -258,14 +258,12 @@ const parse = function (api) {
|
|
|
258
258
|
const { startIndex, endIndex } = token.titleContent;
|
|
259
259
|
title = character.calcEscapedStringFromNodePoints(nodePoints, startIndex + 1, endIndex - 1);
|
|
260
260
|
}
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
url,
|
|
264
|
-
title,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return result;
|
|
268
|
-
},
|
|
261
|
+
const children = api.parseInlineTokens(token.children);
|
|
262
|
+
const node = api.shouldReservePosition
|
|
263
|
+
? { type: ast.LinkType, position: api.calcPosition(token), url, title, children }
|
|
264
|
+
: { type: ast.LinkType, url, title, children };
|
|
265
|
+
return node;
|
|
266
|
+
}),
|
|
269
267
|
};
|
|
270
268
|
};
|
|
271
269
|
|
package/lib/esm/index.js
CHANGED
|
@@ -237,7 +237,7 @@ const match = function (api) {
|
|
|
237
237
|
|
|
238
238
|
const parse = function (api) {
|
|
239
239
|
return {
|
|
240
|
-
parse: (token
|
|
240
|
+
parse: tokens => tokens.map(token => {
|
|
241
241
|
const nodePoints = api.getNodePoints();
|
|
242
242
|
let url = '';
|
|
243
243
|
if (token.destinationContent != null) {
|
|
@@ -254,14 +254,12 @@ const parse = function (api) {
|
|
|
254
254
|
const { startIndex, endIndex } = token.titleContent;
|
|
255
255
|
title = calcEscapedStringFromNodePoints(nodePoints, startIndex + 1, endIndex - 1);
|
|
256
256
|
}
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
url,
|
|
260
|
-
title,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return result;
|
|
264
|
-
},
|
|
257
|
+
const children = api.parseInlineTokens(token.children);
|
|
258
|
+
const node = api.shouldReservePosition
|
|
259
|
+
? { type: LinkType, position: api.calcPosition(token), url, title, children }
|
|
260
|
+
: { type: LinkType, url, title, children };
|
|
261
|
+
return node;
|
|
262
|
+
}),
|
|
265
263
|
};
|
|
266
264
|
};
|
|
267
265
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-link",
|
|
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,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": "^2.0.0-alpha.
|
|
39
|
-
"@yozora/character": "^2.0.0-alpha.
|
|
40
|
-
"@yozora/core-tokenizer": "^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
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "da59d85520455c59a117a35032ef1a035c10ea21"
|
|
43
43
|
}
|