From b6afc53eeaa0ea78273dfc64a9b6e06c75b99d69 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:59:01 -0700 Subject: [PATCH] addTalkPageBanners: |living= and |listas= go in banner shell (#378) instead of in {{WikiProject Biography}} --- src/modules/core.js | 19 ++++++++++++++----- tests/test-core.js | 12 ++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/modules/core.js b/src/modules/core.js index 5d2e9240..4d2776a2 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -1676,14 +1676,22 @@ // delete existing biography banner. when accepting, reviewer is forced to choose if it's a biography or not, so we'll add (or not add) our own biography banner later banners = banners.filter( ( value ) => !value.match( /^{{WikiProject Biography/i ) ); - // add biography banner to array + // add biography banner to array. and add |living= and |listas= to banner shell + let bannerShellExtraParams = ''; if ( isBiography ) { banners.push( - '{{WikiProject Biography |living=' + - ( lifeStatus !== 'unknown' ? ( lifeStatus === 'living' ? 'yes' : 'no' ) : '' ) + - ' |listas=' + subjectName + - '}}' + '{{WikiProject Biography}}' ); + + if ( lifeStatus === 'living' ) { + bannerShellExtraParams += ' |living=yes'; + } else if ( lifeStatus === 'dead' ) { + bannerShellExtraParams += ' |living=no'; + } + + if ( subjectName ) { + bannerShellExtraParams += ' |listas=' + subjectName; + } } // add disambiguation banner to array @@ -1708,6 +1716,7 @@ // Add |1=. Improves readability when lots of other parameters present. wikicode = '{{WikiProject banner shell' + ( newAssessment ? ' |class=' + newAssessment : '' ) + + bannerShellExtraParams + ' |1=\n' + banners.join( '\n' ) + '\n}}\n' + diff --git a/tests/test-core.js b/tests/test-core.js index 0bc9a187..751c1dc0 100644 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -281,12 +281,12 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|