From 39e14fe7af1dc3db0281cc58c80a699ada918ae2 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Thu, 7 Nov 2024 00:02:12 -0800 Subject: [PATCH] addTalkPageBanners: fix |class={{{class}}} bug (#393) fixes #392 --- src/modules/core.js | 3 ++ tests/test-core.js | 84 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/src/modules/core.js b/src/modules/core.js index e33265c8..d37f29bf 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -1647,6 +1647,9 @@ * @return {Object} wikicode */ addTalkPageBanners: function ( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName ) { + // delete |class={{{class}}} throughout the page. this is a bit too broad, but is easier than rewriting the below regexes to deal with nested templates + wikicode = wikicode.replace( /\s*\|\s*class\s*=\s*\{\{\{class\}\}\}/i, '' ); + // build an array of all banners already on page const bannerTemplates = 'wikiproject (?!banner)|football|oka'; const bannerTemplateRegEx = new RegExp( '{{(?:' + bannerTemplates + ')[^}]*}}', 'gi' ); diff --git a/tests/test-core.js b/tests/test-core.js index 4daa2c0b..52c646e9 100644 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -423,6 +423,90 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|