wikiparser-node 1.41.0 → 1.42.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/README.md +5 -3
- package/bundle/bundle-es8.min.js +27 -27
- package/bundle/bundle-lsp.min.js +28 -28
- package/bundle/bundle.min.js +19 -19
- package/dist/addon/attribute.js +1 -1
- package/dist/addon/transclude.js +1 -3
- package/dist/bin/config.js +1 -1
- package/dist/index.js +1 -2
- package/dist/lib/element.d.ts +3 -8
- package/dist/lib/element.js +2 -26
- package/dist/lib/lsp.d.ts +2 -0
- package/dist/lib/lsp.js +8 -20
- package/dist/lib/node.d.ts +2 -0
- package/dist/lib/node.js +0 -7
- package/dist/lib/range.d.ts +0 -7
- package/dist/lib/range.js +5 -14
- package/dist/lib/text.js +3 -5
- package/dist/map.d.ts +66 -0
- package/dist/map.js +2 -0
- package/dist/mixin/attributesParent.d.ts +4 -3
- package/dist/mixin/elementLike.d.ts +13 -0
- package/dist/mixin/elementLike.js +66 -53
- package/dist/parser/selector.js +3 -3
- package/dist/render/extension.js +139 -8
- package/dist/render/html.js +72 -3
- package/dist/src/attribute.d.ts +2 -2
- package/dist/src/attribute.js +17 -13
- package/dist/src/attributes.d.ts +3 -3
- package/dist/src/attributes.js +30 -14
- package/dist/src/extLink.js +5 -4
- package/dist/src/heading.js +11 -3
- package/dist/src/index.js +3 -4
- package/dist/src/link/base.js +2 -4
- package/dist/src/link/file.js +5 -5
- package/dist/src/link/galleryImage.js +1 -3
- package/dist/src/magicLink.js +6 -5
- package/dist/src/multiLine/gallery.js +2 -3
- package/dist/src/nowiki/doubleUnderscore.d.ts +1 -0
- package/dist/src/nowiki/doubleUnderscore.js +4 -1
- package/dist/src/nowiki/quote.js +1 -3
- package/dist/src/parameter.js +5 -2
- package/dist/src/table/td.d.ts +2 -2
- package/dist/src/table/td.js +1 -1
- package/dist/src/tag/html.js +29 -12
- package/dist/src/tagPair/ext.js +4 -1
- package/dist/src/tagPair/translate.d.ts +1 -1
- package/dist/src/tagPair/translate.js +1 -1
- package/dist/util/debug.js +5 -7
- package/dist/util/html.js +3 -11
- package/extensions/dist/base.js +1 -1
- package/package.json +5 -5
package/dist/src/link/file.js
CHANGED
|
@@ -501,13 +501,13 @@ let FileToken = (() => {
|
|
|
501
501
|
/* c8 ignore stop */
|
|
502
502
|
/** @private */
|
|
503
503
|
toHtmlInternal(opt) {
|
|
504
|
-
const { link, width, height, type } = this, file = this.getAttribute('title'), fr = this.getFrame(), manual = fr instanceof title_1.Title,
|
|
504
|
+
const { link, width, height, type } = this, file = this.getAttribute('title'), fr = this.getFrame(), manual = fr instanceof title_1.Title, framed = fr === 'framed', visibleCaption = manual || framed || fr === 'thumbnail' || type === 'gallery-image', caption = this.getArg('caption')?.toHtmlInternal({
|
|
505
505
|
...opt,
|
|
506
506
|
nowrap: true,
|
|
507
507
|
}) ?? '', titleFromCaption = visibleCaption && type !== 'gallery-image' ? '' : (0, string_1.sanitizeAlt)(caption), hasLink = manual || link !== file, title = titleFromCaption || (hasLink && typeof link !== 'string' ? link.getTitleAttr() : ''), titleAttr = title && ` title="${title}"`, alt = (0, string_1.sanitizeAlt)(this.getArg('alt')?.toHtmlInternal({
|
|
508
508
|
...opt,
|
|
509
509
|
nowrap: true,
|
|
510
|
-
})) ?? titleFromCaption, horiz = this.getHorizAlign() ?? '', vert = this.getVertAlign() ?? '', className = `${horiz ? `mw-halign-${horiz}` : vert && `mw-valign-${vert}`}${this.getValue('border') ? ' mw-image-border' : ''} ${(0, string_1.sanitizeAlt)(this.getValue('class')) ?? ''}`.trim(), classAttr = className && ` class="${className}"
|
|
510
|
+
})) ?? titleFromCaption, horiz = this.getHorizAlign() ?? '', vert = this.getVertAlign() ?? '', hasWidth = isInteger(width), hasHeight = isInteger(height), className = `${manual || framed || hasWidth || hasHeight ? '' : 'mw-default-size '}${horiz ? `mw-halign-${horiz}` : vert && `mw-valign-${vert}`}${this.getValue('border') ? ' mw-image-border' : ''} ${(0, string_1.sanitizeAlt)(this.getValue('class')) ?? ''}`.trim(), classAttr = className && ` class="${className}"`;
|
|
511
511
|
let src;
|
|
512
512
|
try {
|
|
513
513
|
src = manual ? fr.getFileUrl() : file.getFileUrl(hasWidth && Number(width), hasHeight && Number(height));
|
|
@@ -523,10 +523,10 @@ let FileToken = (() => {
|
|
|
523
523
|
if (link === file) {
|
|
524
524
|
const lang = this.getValue('lang'), page = this.getValue('page');
|
|
525
525
|
if (lang) {
|
|
526
|
-
href += `?lang=${lang}`;
|
|
526
|
+
href += `?lang=${(0, string_1.sanitizeId)(lang)}`;
|
|
527
527
|
}
|
|
528
528
|
else if (page) {
|
|
529
|
-
href += `?page=${page}`;
|
|
529
|
+
href += `?page=${(0, string_1.sanitizeId)(page)}`;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
}
|
|
@@ -540,7 +540,7 @@ let FileToken = (() => {
|
|
|
540
540
|
? `<figure${classAttr} typeof="mw:File${fr ? `/${manual ? 'Thumb' : frame.get(fr)}` : ''}">${a}<figcaption>${caption}</figcaption></figure>`
|
|
541
541
|
: `<span${classAttr}>${a}</span>`;
|
|
542
542
|
}
|
|
543
|
-
const parent = this.parentNode,
|
|
543
|
+
const parent = this.parentNode, nolines = parent?.parentNode?.getAttr('mode')?.toLowerCase() === 'nolines', padding = nolines ? 0 : 30;
|
|
544
544
|
return `\t<li class="gallerybox" style="width: ${Number(width) + padding + 5}px">\n\t\t<div class="thumb" style="width: ${Number(width) + padding}px${nolines ? '' : `; height: ${Number(height) + padding}px`}"><span>${a}</span></div>\n\t\t<div class="gallerytext">${parent?.parentNode?.hasAttr('showfilename')
|
|
545
545
|
? `<a href="${file.getUrl()}" class="galleryfilename galleryfilename-truncate" title="${file.title}">${file.main}</a>\n`
|
|
546
546
|
: ''}${caption}</div>\n\t</li>`;
|
|
@@ -144,9 +144,7 @@ let GalleryImageToken = (() => {
|
|
|
144
144
|
* @param i position to be inserted at / 插入位置
|
|
145
145
|
*/
|
|
146
146
|
insertAt(child, i) {
|
|
147
|
-
if (this.type === 'gallery-image'
|
|
148
|
-
&& child.is('image-parameter')
|
|
149
|
-
&& !constants_1.galleryParams.has(child.name)) {
|
|
147
|
+
if (this.type === 'gallery-image' && child.is('image-parameter') && !constants_1.galleryParams.has(child.name)) {
|
|
150
148
|
child.setAttribute('name', 'invalid');
|
|
151
149
|
}
|
|
152
150
|
return super.insertAt(child, i);
|
package/dist/src/magicLink.js
CHANGED
|
@@ -246,7 +246,7 @@ let MagicLinkToken = (() => {
|
|
|
246
246
|
.getUrl(articlePath)
|
|
247
247
|
: new URL(link.startsWith('RFC')
|
|
248
248
|
? `https://datatracker.ietf.org/doc/html/rfc${link.slice(4)}`
|
|
249
|
-
: `https://
|
|
249
|
+
: `https://www.ncbi.nlm.nih.gov/pubmed/${link.slice(5)}?dopt=Abstract`);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
/* PRINT ONLY */
|
|
@@ -300,10 +300,11 @@ let MagicLinkToken = (() => {
|
|
|
300
300
|
url = this.getUrl();
|
|
301
301
|
}
|
|
302
302
|
catch { }
|
|
303
|
-
const attrs = type === 'free-ext-link' || type === 'ext-link-url'
|
|
304
|
-
? ` rel="nofollow" class="external
|
|
305
|
-
: (
|
|
306
|
-
+ (url === undefined ? '' : ` href="${typeof url === 'string' ? url : url.href}"`)
|
|
303
|
+
const isISBN = protocol === 'ISBN', attrs = type === 'free-ext-link' || type === 'ext-link-url'
|
|
304
|
+
? ` rel="nofollow" class="external free"${typeof url === 'object' ? ` href="${url.href}"` : ''}`
|
|
305
|
+
: (isISBN ? '' : ` class="external mw-magiclink-${protocol.toLowerCase()}" rel="nofollow"`)
|
|
306
|
+
+ (url === undefined ? '' : ` href="${typeof url === 'string' ? url : url.href}"`)
|
|
307
|
+
+ (isISBN ? ' class="internal mw-magiclink-isbn"' : '');
|
|
307
308
|
return `<a${attrs}>${innerText}</a>`;
|
|
308
309
|
}
|
|
309
310
|
};
|
|
@@ -176,7 +176,7 @@ let GalleryToken = (() => {
|
|
|
176
176
|
*/
|
|
177
177
|
#getSize(key) {
|
|
178
178
|
LSP: {
|
|
179
|
-
const widths = this.parentNode?.getAttr(key), mt =
|
|
179
|
+
const widths = this.parentNode?.getAttr(key), mt = widths && /^(\d+)\s*(?:px)?$/u.exec(widths)?.[1];
|
|
180
180
|
return mt && Number(mt) || 120;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -208,8 +208,7 @@ let GalleryToken = (() => {
|
|
|
208
208
|
throw new SyntaxError(`Invalid file name: ${file}`);
|
|
209
209
|
}
|
|
210
210
|
insertAt(token, i = this.length) {
|
|
211
|
-
if (!debug_1.Shadow.running
|
|
212
|
-
&& (typeof token === 'string' ? token.trim() : !token.is('gallery-image'))) {
|
|
211
|
+
if (!debug_1.Shadow.running && (typeof token === 'string' ? token.trim() : !token.is('gallery-image'))) {
|
|
213
212
|
throw new RangeError('Please do not insert invisible content into <gallery>!');
|
|
214
213
|
}
|
|
215
214
|
return super.insertAt(token, i);
|
|
@@ -49,7 +49,7 @@ const syntax_1 = require("../../mixin/syntax");
|
|
|
49
49
|
* 状态开关
|
|
50
50
|
*/
|
|
51
51
|
let DoubleUnderscoreToken = (() => {
|
|
52
|
-
let _classDecorators = [(0, syntax_1.syntax)(), (0, hidden_1.hiddenToken)(), (0, padded_1.padded)('__')];
|
|
52
|
+
let _classDecorators = [(0, syntax_1.syntax)(), (0, hidden_1.hiddenToken)(true, false), (0, padded_1.padded)('__')];
|
|
53
53
|
let _classDescriptor;
|
|
54
54
|
let _classExtraInitializers = [];
|
|
55
55
|
let _classThis;
|
|
@@ -101,6 +101,9 @@ let DoubleUnderscoreToken = (() => {
|
|
|
101
101
|
// @ts-expect-error abstract class
|
|
102
102
|
return debug_1.Shadow.run(() => new DoubleUnderscoreToken(this.innerText, this.#sensitive, this.#fullWidth, this.getAttribute('config')));
|
|
103
103
|
}
|
|
104
|
+
toHtmlInternal() {
|
|
105
|
+
return this.tocData ?? '';
|
|
106
|
+
}
|
|
104
107
|
};
|
|
105
108
|
return DoubleUnderscoreToken = _classThis;
|
|
106
109
|
})();
|
package/dist/src/nowiki/quote.js
CHANGED
|
@@ -113,9 +113,7 @@ let QuoteToken = (() => {
|
|
|
113
113
|
/** @private */
|
|
114
114
|
text() {
|
|
115
115
|
const { parentNode, innerText } = this;
|
|
116
|
-
return parentNode?.is('image-parameter') && parentNode.name !== 'caption'
|
|
117
|
-
? ''
|
|
118
|
-
: innerText;
|
|
116
|
+
return parentNode?.is('image-parameter') && parentNode.name !== 'caption' ? '' : innerText;
|
|
119
117
|
}
|
|
120
118
|
/** @private */
|
|
121
119
|
lint(start = this.getAbsoluteIndex()) {
|
package/dist/src/parameter.js
CHANGED
|
@@ -236,8 +236,11 @@ let ParameterToken = (() => {
|
|
|
236
236
|
* 获取参数值
|
|
237
237
|
*/
|
|
238
238
|
getValue() {
|
|
239
|
-
const value = (0, string_1.removeCommentLine)(
|
|
240
|
-
return
|
|
239
|
+
const { parentNode, lastChild, anon, name } = this, value = (0, string_1.removeCommentLine)(lastChild.text());
|
|
240
|
+
return anon && parentNode?.isTemplate() !== false
|
|
241
|
+
|| name === '2' && parentNode?.type === 'magic-word' && parentNode.name === 'tag'
|
|
242
|
+
? value
|
|
243
|
+
: value.trim();
|
|
241
244
|
}
|
|
242
245
|
/**
|
|
243
246
|
* Set the parameter value
|
package/dist/src/table/td.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export interface TdSpanAttrs {
|
|
|
8
8
|
rowspan?: number;
|
|
9
9
|
colspan?: number;
|
|
10
10
|
}
|
|
11
|
-
declare type TdAttrGetter<T extends string> = T extends keyof TdSpanAttrs ? number : string |
|
|
11
|
+
declare type TdAttrGetter<T extends string> = T extends keyof TdSpanAttrs ? number : string | undefined;
|
|
12
12
|
declare type TdAttrSetter<T extends string> = T extends keyof TdSpanAttrs ? number : string | boolean;
|
|
13
|
-
export type TdAttrs = Record<string, string
|
|
13
|
+
export type TdAttrs = Record<string, string> & TdSpanAttrs;
|
|
14
14
|
/**
|
|
15
15
|
* `<td>`, `<th>` or `<caption>`
|
|
16
16
|
*
|
package/dist/src/table/td.js
CHANGED
|
@@ -258,7 +258,7 @@ let TdToken = (() => {
|
|
|
258
258
|
key = (0, string_1.trimLc)(key);
|
|
259
259
|
/* NOT FOR BROWSER END */
|
|
260
260
|
const value = super.getAttr(key);
|
|
261
|
-
return (key === 'rowspan' || key === 'colspan' ? parseInt(value) || 1 : value);
|
|
261
|
+
return (key === 'rowspan' || key === 'colspan' ? parseInt(value || '') || 1 : value);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
/** @private */
|
package/dist/src/tag/html.js
CHANGED
|
@@ -88,12 +88,15 @@ let HtmlToken = (() => {
|
|
|
88
88
|
let _classThis;
|
|
89
89
|
let _classSuper = index_2.TagToken;
|
|
90
90
|
let _instanceExtraInitializers = [];
|
|
91
|
+
let _getTocLine_decorators;
|
|
91
92
|
let _toHtmlInternal_decorators;
|
|
92
93
|
var HtmlToken = class extends _classSuper {
|
|
93
94
|
static { _classThis = this; }
|
|
94
95
|
static {
|
|
95
96
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
97
|
+
_getTocLine_decorators = [(0, cached_1.cached)()];
|
|
96
98
|
_toHtmlInternal_decorators = [(0, cached_1.cached)()];
|
|
99
|
+
__esDecorate(this, null, _getTocLine_decorators, { kind: "method", name: "getTocLine", static: false, private: false, access: { has: obj => "getTocLine" in obj, get: obj => obj.getTocLine }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
97
100
|
__esDecorate(this, null, _toHtmlInternal_decorators, { kind: "method", name: "toHtmlInternal", static: false, private: false, access: { has: obj => "toHtmlInternal" in obj, get: obj => obj.toHtmlInternal }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
98
101
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
99
102
|
HtmlToken = _classThis = _classDescriptor.value;
|
|
@@ -319,25 +322,39 @@ let HtmlToken = (() => {
|
|
|
319
322
|
}
|
|
320
323
|
}
|
|
321
324
|
/** @private */
|
|
325
|
+
getTocLine() {
|
|
326
|
+
if (this.closing || !/^h\d$/u.test(this.name)) {
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
const matched = this.findMatchingTag();
|
|
330
|
+
if (!matched) {
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
const range = this.createRange();
|
|
334
|
+
range.setStartAfter(this);
|
|
335
|
+
range.setEndBefore(matched);
|
|
336
|
+
const content = (0, html_1.html)(range.cloneContents(), '', { nocc: true });
|
|
337
|
+
return [(0, html_1.getId)(content), content];
|
|
338
|
+
}
|
|
339
|
+
/** @private */
|
|
322
340
|
toHtmlInternal() {
|
|
323
|
-
const { closing, name } = this, [, selfClosingTags, voidTags] = this.getAttribute('config').html, tag = name + (closing ? '' : super.toHtmlInternal());
|
|
341
|
+
const { closing, name, selfClosing } = this, [, selfClosingTags, voidTags] = this.getAttribute('config').html, tag = name + (closing ? '' : super.toHtmlInternal());
|
|
324
342
|
if (voidTags.includes(name)) {
|
|
325
343
|
return closing && name !== 'br' ? '' : `<${tag}>`;
|
|
326
344
|
}
|
|
327
|
-
const result = `<${closing ? '/' : ''}${tag}>${
|
|
328
|
-
if (/^h\d$/u.test(name)
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
345
|
+
const result = `<${closing ? '/' : ''}${tag}>${selfClosing && !closing && selfClosingTags.includes(name) ? `</${name}>` : ''}`;
|
|
346
|
+
if (/^h\d$/u.test(name)) {
|
|
347
|
+
if (closing) {
|
|
348
|
+
return result + (this.findMatchingTag()?.id === '' ? '</div>' : '');
|
|
349
|
+
}
|
|
350
|
+
else if (!this.id) {
|
|
351
|
+
const id = this.getTocLine()?.[0];
|
|
352
|
+
if (id !== undefined) {
|
|
353
|
+
return `<div class="mw-heading mw-heading${name.slice(-1)}">${result.slice(0, -1)} id="${id}">`;
|
|
333
354
|
}
|
|
334
|
-
const range = this.createRange();
|
|
335
|
-
range.setStartAfter(this);
|
|
336
|
-
range.setEndBefore(matched);
|
|
337
|
-
return `<div class="mw-heading mw-heading${name.slice(-1)}">${result.slice(0, -1)} id="${(0, html_1.getId)(range.cloneContents())}">`;
|
|
338
355
|
}
|
|
339
356
|
}
|
|
340
|
-
return result;
|
|
357
|
+
return (this.tocData ?? '') + result;
|
|
341
358
|
}
|
|
342
359
|
/** @private */
|
|
343
360
|
getRange() {
|
package/dist/src/tagPair/ext.js
CHANGED
|
@@ -103,6 +103,7 @@ let ExtToken = (() => {
|
|
|
103
103
|
innerToken = new PreToken(inner, newConfig, accum);
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
|
+
newConfig.excludes.push('list');
|
|
106
107
|
// fall through
|
|
107
108
|
case 'indicator':
|
|
108
109
|
case 'poem':
|
|
@@ -125,7 +126,9 @@ let ExtToken = (() => {
|
|
|
125
126
|
case 'tab':
|
|
126
127
|
newConfig.ext = newConfig.ext.filter(e => e !== 'tabs');
|
|
127
128
|
break;
|
|
128
|
-
|
|
129
|
+
case 'ref':
|
|
130
|
+
newConfig.ext = newConfig.ext.filter(e => e !== 'references');
|
|
131
|
+
// no default
|
|
129
132
|
}
|
|
130
133
|
innerToken = new index_2.Token(inner, newConfig, accum);
|
|
131
134
|
break;
|
|
@@ -26,7 +26,7 @@ export declare abstract class TranslateToken extends TagPairToken implements Omi
|
|
|
26
26
|
*/
|
|
27
27
|
constructor(attr?: string, inner?: string, config?: Config, accum?: Token[]);
|
|
28
28
|
/** @implements */
|
|
29
|
-
getAttr(key: string):
|
|
29
|
+
getAttr(key: string): '' | undefined;
|
|
30
30
|
/** @implements */
|
|
31
31
|
hasAttr(key: string): boolean;
|
|
32
32
|
/** @implements */
|
|
@@ -125,7 +125,7 @@ let TranslateToken = (() => {
|
|
|
125
125
|
}
|
|
126
126
|
/** @implements */
|
|
127
127
|
getAttr(key) {
|
|
128
|
-
return (0, string_1.trimLc)(key) === 'nowrap' && this.#isNowrap()
|
|
128
|
+
return (0, string_1.trimLc)(key) === 'nowrap' && this.#isNowrap() ? '' : undefined;
|
|
129
129
|
}
|
|
130
130
|
/** @implements */
|
|
131
131
|
hasAttr(key) {
|
package/dist/util/debug.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCanonicalName = exports.undo = exports.mixin = exports.emptyArray = exports.getMagicWordInfo = exports.setChildNodes = exports.isLink = exports.isRowEnd = exports.
|
|
3
|
+
exports.getCanonicalName = exports.undo = exports.mixin = exports.emptyArray = exports.getMagicWordInfo = exports.setChildNodes = exports.isLink = exports.isRowEnd = exports.Shadow = void 0;
|
|
4
|
+
exports.isToken = isToken;
|
|
4
5
|
exports.Shadow = {
|
|
5
6
|
running: false,
|
|
6
7
|
/** @private */
|
|
@@ -50,12 +51,9 @@ exports.Shadow = {
|
|
|
50
51
|
},
|
|
51
52
|
rev: 0,
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*/
|
|
57
|
-
const isToken = (type) => (node) => node.type === type;
|
|
58
|
-
exports.isToken = isToken;
|
|
54
|
+
function isToken(type) {
|
|
55
|
+
return (node) => node.type === type;
|
|
56
|
+
}
|
|
59
57
|
/**
|
|
60
58
|
* 是否是行尾
|
|
61
59
|
* @param token 节点
|
package/dist/util/html.js
CHANGED
|
@@ -95,9 +95,9 @@ const html = (childNodes, separator, opt = {}) => {
|
|
|
95
95
|
if ((child.length > 0 || /\s$/u.test(innerText))
|
|
96
96
|
&& previousSibling.is('list')
|
|
97
97
|
&& !/[;#*]/u.test(innerText)
|
|
98
|
-
&& child.closest('ext
|
|
98
|
+
&& child.closest('ext#poem,list-range')?.type === 'ext') {
|
|
99
99
|
lastPrefix = '';
|
|
100
|
-
result = `<span style="display: inline-block; margin-inline-start: ${previousSibling.indent}em;">${result}</span>`;
|
|
100
|
+
result = `<span class="mw-poem-indented" style="display: inline-block; margin-inline-start: ${previousSibling.indent}em;">${result}</span>`;
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
103
|
result = result.trim();
|
|
@@ -145,15 +145,7 @@ exports.html = html;
|
|
|
145
145
|
* @param tokens inner tokens of a section heading
|
|
146
146
|
*/
|
|
147
147
|
const getId = (tokens) => {
|
|
148
|
-
|
|
149
|
-
if (typeof tokens === 'string') {
|
|
150
|
-
content = tokens;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
const opt = { nocc: true };
|
|
154
|
-
content = Array.isArray(tokens) ? (0, exports.html)(tokens, '', opt) : tokens.toHtmlInternal(opt);
|
|
155
|
-
}
|
|
156
|
-
const id = (0, string_1.decodeHtml)((0, string_1.sanitizeAlt)(content.replaceAll('_', ' ')))
|
|
148
|
+
const content = typeof tokens === 'string' ? tokens : tokens.toHtmlInternal({ nocc: true }), id = (0, string_1.decodeHtml)((0, string_1.sanitizeAlt)(content.replaceAll('_', ' ')))
|
|
157
149
|
.replace(/[\s_]+/gu, '_');
|
|
158
150
|
return id.endsWith('_') ? id.slice(0, -1) : id;
|
|
159
151
|
};
|
package/extensions/dist/base.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var _a;
|
|
3
|
-
const version = '1.
|
|
3
|
+
const version = '1.42.0', src = (_a = document.currentScript) === null || _a === void 0 ? void 0 : _a.src, file = /\/extensions\/dist\/base\.(?:min\.)?js$/u, CDN = src && file.test(src)
|
|
4
4
|
? src.replace(file, '')
|
|
5
5
|
: `https://fastly.jsdelivr.net/npm/wikiparser-node@${version}`;
|
|
6
6
|
const workerJS = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikiparser-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
4
4
|
"description": "A Node.js parser for MediaWiki markup with AST",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mediawiki",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@bhsd/code-standard": "^2.5.1",
|
|
105
105
|
"@bhsd/test-util": "^1.3.1",
|
|
106
106
|
"@codemirror/lint": "^6.9.6",
|
|
107
|
-
"@eslint/markdown": "^8.0.
|
|
107
|
+
"@eslint/markdown": "^8.0.2",
|
|
108
108
|
"@types/color-name": "^2.0.0",
|
|
109
109
|
"@types/color-rgba": "^2.1.3",
|
|
110
110
|
"@types/mocha": "^10.0.10",
|
|
@@ -116,11 +116,11 @@
|
|
|
116
116
|
"color-rgba": "^3.0.0",
|
|
117
117
|
"diff2html-cli": "^5.2.15",
|
|
118
118
|
"esbuild": "^0.28.0",
|
|
119
|
-
"eslint": "^10.4.
|
|
119
|
+
"eslint": "^10.4.1",
|
|
120
120
|
"markdownlint-cli2": "^0.22.1",
|
|
121
|
-
"mocha": "^11.7.
|
|
121
|
+
"mocha": "^11.7.6",
|
|
122
122
|
"monaco-editor": "~0.53.0",
|
|
123
|
-
"tsx": "^4.22.
|
|
123
|
+
"tsx": "^4.22.3",
|
|
124
124
|
"typescript": "^6.0.3",
|
|
125
125
|
"v8r": "^6.1.0",
|
|
126
126
|
"vscode-languageserver-textdocument": "^1.0.12"
|