From 711bf01049fccda5c041f6ad5022c936dbbff6f9 Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Sun, 9 Mar 2025 23:31:15 +0800 Subject: [PATCH] refactor: fold commentText variable --- core/modules/parsers/wikiparser/rules/commentblock.js | 3 +-- core/modules/parsers/wikiparser/rules/commentinline.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/commentblock.js b/core/modules/parsers/wikiparser/rules/commentblock.js index 997be818c..5f87020ca 100644 --- a/core/modules/parsers/wikiparser/rules/commentblock.js +++ b/core/modules/parsers/wikiparser/rules/commentblock.js @@ -53,11 +53,10 @@ exports.parse = function() { // Return a node representing the comment that is not rendered var commentStart = this.match.index; var commentEnd = this.endMatch.index + this.endMatch[0].length; - var commentText = this.parser.source.slice(commentStart, commentEnd); return [{ type: "void", children: [], - text: commentText, + text: this.parser.source.slice(commentStart, commentEnd), start: commentStart, end: commentEnd }]; diff --git a/core/modules/parsers/wikiparser/rules/commentinline.js b/core/modules/parsers/wikiparser/rules/commentinline.js index f39d9f6ff..b96f5d78b 100644 --- a/core/modules/parsers/wikiparser/rules/commentinline.js +++ b/core/modules/parsers/wikiparser/rules/commentinline.js @@ -46,10 +46,9 @@ exports.parse = function() { // Return a node representing the inline comment var commentStart = this.match.index; var commentEnd = this.endMatch.index + this.endMatch[0].length; - var commentText = this.parser.source.slice(commentStart, commentEnd); return [{ type: "void", - text: commentText, + text: this.parser.source.slice(commentStart, commentEnd), start: commentStart, end: commentEnd }];