From 9fc314aef340f7d9e96e9f3416e57de2881ddace Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Thu, 23 Nov 2023 23:49:20 +0800 Subject: [PATCH 1/2] style: new way to mark use for browser --- src/pre.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pre.ts b/src/pre.ts index c6fdad400..77244fcb7 100644 --- a/src/pre.ts +++ b/src/pre.ts @@ -62,13 +62,13 @@ export class PreToken extends Token { this.setAttribute('stage', Parser.MAX_STAGE - 1); } - /* NOT FOR BROWSER */ - /** @private */ protected override isPlain(): boolean { return true; } + /* NOT FOR BROWSER */ + /** @override */ override cloneNode(): this { const cloned = this.cloneChildNodes(); From e32b379dce113265df55497d35f7f969c40f1125 Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Thu, 23 Nov 2023 23:47:32 +0800 Subject: [PATCH 2/2] fix: no Parser.parsers --- parser/braces.ts | 2 -- parser/commentAndExt.ts | 2 -- parser/converter.ts | 2 -- parser/externalLinks.ts | 2 -- parser/hrAndDoubleUnderscore.ts | 2 -- parser/html.ts | 2 -- parser/links.ts | 2 -- parser/list.ts | 2 -- parser/magicLinks.ts | 2 -- parser/quotes.ts | 2 -- parser/table.ts | 2 -- src/transclude.ts | 3 --- typings/node.d.ts | 1 - 13 files changed, 26 deletions(-) diff --git a/parser/braces.ts b/parser/braces.ts index 556cc999c..f590f2bec 100644 --- a/parser/braces.ts +++ b/parser/braces.ts @@ -127,5 +127,3 @@ export const parseBraces = (wikitext: string, config = Parser.getConfig(), accum } return wikitext; }; - -Parser.parsers['parseBraces'] = __filename; diff --git a/parser/commentAndExt.ts b/parser/commentAndExt.ts index d58a7a80e..617576255 100644 --- a/parser/commentAndExt.ts +++ b/parser/commentAndExt.ts @@ -81,5 +81,3 @@ export const parseCommentAndExt = ( }, ); }; - -Parser.parsers['parseCommentAndExt'] = __filename; diff --git a/parser/converter.ts b/parser/converter.ts index 856745f69..92e6ffabe 100644 --- a/parser/converter.ts +++ b/parser/converter.ts @@ -42,5 +42,3 @@ export const parseConverter = (text: string, config = Parser.getConfig(), accum: } return text; }; - -Parser.parsers['parseConverter'] = __filename; diff --git a/parser/externalLinks.ts b/parser/externalLinks.ts index 41c5e65e0..d21bb829e 100644 --- a/parser/externalLinks.ts +++ b/parser/externalLinks.ts @@ -28,5 +28,3 @@ export const parseExternalLinks = (wikitext: string, config = Parser.getConfig() return `\0${length}w\x7F`; }); }; - -Parser.parsers['parseExternalLinks'] = __filename; diff --git a/parser/hrAndDoubleUnderscore.ts b/parser/hrAndDoubleUnderscore.ts index a03b1018c..88273b042 100644 --- a/parser/hrAndDoubleUnderscore.ts +++ b/parser/hrAndDoubleUnderscore.ts @@ -48,5 +48,3 @@ export const parseHrAndDoubleUnderscore = ( ); return type === 'root' || type === 'ext-inner' && name === 'poem' ? data : data.slice(1); }; - -Parser.parsers['parseHrAndDoubleUnderscore'] = __filename; diff --git a/parser/html.ts b/parser/html.ts index 45bad1b0a..7a1e25089 100644 --- a/parser/html.ts +++ b/parser/html.ts @@ -37,5 +37,3 @@ export const parseHtml = (wikitext: string, config = Parser.getConfig(), accum: } return text; }; - -Parser.parsers['parseHtml'] = __filename; diff --git a/parser/links.ts b/parser/links.ts index 58f56dd59..24bf136a7 100644 --- a/parser/links.ts +++ b/parser/links.ts @@ -93,5 +93,3 @@ export const parseLinks = (wikitext: string, config = Parser.getConfig(), accum: } return s; }; - -Parser.parsers['parseLinks'] = __filename; diff --git a/parser/list.ts b/parser/list.ts index 348fc4bad..19bb8b425 100644 --- a/parser/list.ts +++ b/parser/list.ts @@ -54,5 +54,3 @@ export const parseList = (wikitext: string, config = Parser.getConfig(), accum: } return text; }; - -Parser.parsers['parseList'] = __filename; diff --git a/parser/magicLinks.ts b/parser/magicLinks.ts index 8a6f257d4..528debf9a 100644 --- a/parser/magicLinks.ts +++ b/parser/magicLinks.ts @@ -36,5 +36,3 @@ export const parseMagicLinks = (wikitext: string, config = Parser.getConfig(), a return `\0${accum.length - 1}w\x7F${trail}`; }); }; - -Parser.parsers['parseMagicLinks'] = __filename; diff --git a/parser/quotes.ts b/parser/quotes.ts index dfad6ad97..671e6754b 100644 --- a/parser/quotes.ts +++ b/parser/quotes.ts @@ -63,5 +63,3 @@ export const parseQuotes = (wikitext: string, config = Parser.getConfig(), accum } return arr.join(''); }; - -Parser.parsers['parseQuotes'] = __filename; diff --git a/parser/table.ts b/parser/table.ts index 6d33fc2ec..99515c31e 100644 --- a/parser/table.ts +++ b/parser/table.ts @@ -110,5 +110,3 @@ export const parseTable = ( } return out.slice(1); }; - -Parser.parsers['parseTable'] = __filename; diff --git a/src/transclude.ts b/src/transclude.ts index 2a76a7b43..fdcf2ff31 100644 --- a/src/transclude.ts +++ b/src/transclude.ts @@ -222,9 +222,6 @@ export class TranscludeToken extends Token { newName = String(i + 1); if (name !== newName) { this.getArgs(newName, false, false).add(token.setAttribute('name', newName) as ParameterToken); - if (name) { - this.getArgs(name, false, false).delete(token); - } } } } diff --git a/typings/node.d.ts b/typings/node.d.ts index 9d641f563..53b88cdf2 100644 --- a/typings/node.d.ts +++ b/typings/node.d.ts @@ -1,4 +1,3 @@ -import type {Ranges} from '../lib/ranges'; import type {Config} from '../index'; import type {AstNodes, Token, ParameterToken} from '../internal';