wikiparser-node 1.6.0 → 1.6.1
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/dist/lib/ranges.js +3 -0
- package/dist/src/imageParameter.js +2 -2
- package/dist/src/index.js +1 -1
- package/dist/src/link/base.js +2 -2
- package/dist/src/table/index.js +5 -1
- package/dist/src/table/td.js +3 -3
- package/dist/src/transclude.js +2 -2
- package/dist/util/debug.js +1 -1
- package/package.json +1 -1
package/dist/lib/ranges.js
CHANGED
|
@@ -37,9 +37,9 @@ function validate(key, val, config, halfParsed = false, ext) {
|
|
|
37
37
|
case 'manualthumb':
|
|
38
38
|
return true;
|
|
39
39
|
case 'page':
|
|
40
|
-
return (ext === 'djvu' || ext === 'djv') && Number(value) > 0;
|
|
40
|
+
return (ext === 'djvu' || ext === 'djv' || ext === 'pdf') && Number(value) > 0;
|
|
41
41
|
default:
|
|
42
|
-
return !
|
|
42
|
+
return Boolean(value) && !isNaN(value);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
/** 图片参数 */
|
package/dist/src/index.js
CHANGED
|
@@ -156,7 +156,7 @@ class Token extends element_1.AstElement {
|
|
|
156
156
|
if (i % 2 === 0) {
|
|
157
157
|
return new text_1.AstText(s);
|
|
158
158
|
}
|
|
159
|
-
else if (
|
|
159
|
+
else if (isNaN(s.slice(-1))) {
|
|
160
160
|
return this.#accum[Number(s.slice(0, -1))];
|
|
161
161
|
}
|
|
162
162
|
throw new Error(`解析错误!未正确标记的 Token:${s}`);
|
package/dist/src/link/base.js
CHANGED
|
@@ -98,7 +98,7 @@ class LinkBaseToken extends index_2.Token {
|
|
|
98
98
|
/** @private */
|
|
99
99
|
setAttribute(key, value) {
|
|
100
100
|
if (key === 'bracket') {
|
|
101
|
-
this.#bracket =
|
|
101
|
+
this.#bracket = value;
|
|
102
102
|
}
|
|
103
103
|
else if (key === 'title') {
|
|
104
104
|
this.#title = value;
|
|
@@ -196,7 +196,7 @@ class LinkBaseToken extends index_2.Token {
|
|
|
196
196
|
* @param link 链接目标
|
|
197
197
|
*/
|
|
198
198
|
setTarget(link) {
|
|
199
|
-
const config = this.getAttribute('config'), { childNodes } = index_1.default.parse(
|
|
199
|
+
const config = this.getAttribute('config'), { childNodes } = index_1.default.parse(link, this.getAttribute('include'), 2, config), token = debug_1.Shadow.run(() => new atom_1.AtomToken(undefined, 'link-target', config, [], {
|
|
200
200
|
'Stage-2': ':', '!ExtToken': '', '!HeadingToken': '',
|
|
201
201
|
}));
|
|
202
202
|
token.append(...childNodes);
|
package/dist/src/table/index.js
CHANGED
|
@@ -94,7 +94,11 @@ class TableToken extends trBase_1.TrBaseToken {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
if (j < length) {
|
|
97
|
-
|
|
97
|
+
const e = (0, lint_1.generateForChild)(this.getNthRow(j), { start }, 'table-layout', 'inconsistent table layout', 'warning');
|
|
98
|
+
e.startIndex++;
|
|
99
|
+
e.startLine++;
|
|
100
|
+
e.startCol = 0;
|
|
101
|
+
errors.push(e);
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
return errors;
|
package/dist/src/table/td.js
CHANGED
|
@@ -231,7 +231,7 @@ let TdToken = (() => {
|
|
|
231
231
|
getAttr(key) {
|
|
232
232
|
const value = super.getAttr(key);
|
|
233
233
|
key = key.toLowerCase().trim();
|
|
234
|
-
return (key === 'rowspan' || key === 'colspan' ?
|
|
234
|
+
return (key === 'rowspan' || key === 'colspan' ? parseInt(value) || 1 : value);
|
|
235
235
|
}
|
|
236
236
|
/** @override */
|
|
237
237
|
print() {
|
|
@@ -290,10 +290,10 @@ let TdToken = (() => {
|
|
|
290
290
|
getAttrs() {
|
|
291
291
|
const attr = super.getAttrs();
|
|
292
292
|
if ('rowspan' in attr) {
|
|
293
|
-
attr.rowspan =
|
|
293
|
+
attr.rowspan = parseInt(attr.rowspan);
|
|
294
294
|
}
|
|
295
295
|
if ('colspan' in attr) {
|
|
296
|
-
attr.colspan =
|
|
296
|
+
attr.colspan = parseInt(attr.colspan);
|
|
297
297
|
}
|
|
298
298
|
return attr;
|
|
299
299
|
}
|
package/dist/src/transclude.js
CHANGED
|
@@ -326,7 +326,7 @@ class TranscludeToken extends index_2.Token {
|
|
|
326
326
|
this.#args.set(keyStr, args);
|
|
327
327
|
}
|
|
328
328
|
/* NOT FOR BROWSER */
|
|
329
|
-
if (exact && !
|
|
329
|
+
if (exact && keyStr.trim() && !isNaN(keyStr)) {
|
|
330
330
|
args = new Set([...args].filter(({ anon }) => typeof key === 'number' === anon));
|
|
331
331
|
}
|
|
332
332
|
else if (copy) {
|
|
@@ -634,7 +634,7 @@ class TranscludeToken extends index_2.Token {
|
|
|
634
634
|
values.set(val, [arg]);
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
|
-
let noMoreAnon = anonCount === 0 ||
|
|
637
|
+
let noMoreAnon = anonCount === 0 || !key.trim() || isNaN(key);
|
|
638
638
|
const emptyArgs = values.get('') ?? [], duplicatedArgs = [...values].filter(([val, { length }]) => val && length > 1).flatMap(([, curArgs]) => {
|
|
639
639
|
const anonIndex = noMoreAnon ? -1 : curArgs.findIndex(({ anon }) => anon);
|
|
640
640
|
if (anonIndex !== -1) {
|
package/dist/util/debug.js
CHANGED