From 7c753d0919af2f892bf5c9679daea1df76d0398e Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Thu, 31 Oct 2024 21:44:55 -0700 Subject: [PATCH] addTalkPageBanners: fix |class={{{class}}} bug 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|