@yozora/tokenizer-image-reference 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 +20 -10
- package/lib/esm/index.js +20 -10
- package/package.json +7 -7
package/lib/cjs/index.js
CHANGED
|
@@ -128,18 +128,28 @@ const match = function (api) {
|
|
|
128
128
|
|
|
129
129
|
const parse = function (api) {
|
|
130
130
|
return {
|
|
131
|
-
parse: (token
|
|
131
|
+
parse: tokens => tokens.map(token => {
|
|
132
132
|
const { identifier, label, referenceType } = token;
|
|
133
|
+
const children = api.parseInlineTokens(token.children);
|
|
133
134
|
const alt = tokenizerImage.calcImageAlt(children);
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
const node = api.shouldReservePosition
|
|
136
|
+
? {
|
|
137
|
+
type: ast.ImageReferenceType,
|
|
138
|
+
position: api.calcPosition(token),
|
|
139
|
+
identifier,
|
|
140
|
+
label,
|
|
141
|
+
referenceType,
|
|
142
|
+
alt,
|
|
143
|
+
}
|
|
144
|
+
: {
|
|
145
|
+
type: ast.ImageReferenceType,
|
|
146
|
+
identifier,
|
|
147
|
+
label,
|
|
148
|
+
referenceType,
|
|
149
|
+
alt,
|
|
150
|
+
};
|
|
151
|
+
return node;
|
|
152
|
+
}),
|
|
143
153
|
};
|
|
144
154
|
};
|
|
145
155
|
|
package/lib/esm/index.js
CHANGED
|
@@ -124,18 +124,28 @@ const match = function (api) {
|
|
|
124
124
|
|
|
125
125
|
const parse = function (api) {
|
|
126
126
|
return {
|
|
127
|
-
parse: (token
|
|
127
|
+
parse: tokens => tokens.map(token => {
|
|
128
128
|
const { identifier, label, referenceType } = token;
|
|
129
|
+
const children = api.parseInlineTokens(token.children);
|
|
129
130
|
const alt = calcImageAlt(children);
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
const node = api.shouldReservePosition
|
|
132
|
+
? {
|
|
133
|
+
type: ImageReferenceType,
|
|
134
|
+
position: api.calcPosition(token),
|
|
135
|
+
identifier,
|
|
136
|
+
label,
|
|
137
|
+
referenceType,
|
|
138
|
+
alt,
|
|
139
|
+
}
|
|
140
|
+
: {
|
|
141
|
+
type: ImageReferenceType,
|
|
142
|
+
identifier,
|
|
143
|
+
label,
|
|
144
|
+
referenceType,
|
|
145
|
+
alt,
|
|
146
|
+
};
|
|
147
|
+
return node;
|
|
148
|
+
}),
|
|
139
149
|
};
|
|
140
150
|
};
|
|
141
151
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-image-reference",
|
|
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,11 +35,11 @@
|
|
|
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-image": "^2.0.0-alpha.
|
|
42
|
-
"@yozora/tokenizer-link": "^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-image": "^2.0.0-alpha.2",
|
|
42
|
+
"@yozora/tokenizer-link": "^2.0.0-alpha.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "da59d85520455c59a117a35032ef1a035c10ea21"
|
|
45
45
|
}
|