Skip to content

Commit

Permalink
core: add |1= to {{WikiProject banner shell}} (#373)
Browse files Browse the repository at this point in the history
requested at WT:AFC. makes it more readable when there's multiple parameters
  • Loading branch information
NovemLinguae authored Aug 23, 2024
1 parent 12f709a commit d94dd9f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/modules/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1713,9 +1713,10 @@
// Convert array back to wikitext and append to top of talk page.
// Always add a shell even if it's just wrapping one banner, for code simplification reasons.
// Add |class= to shell.
// Add |1=. Improves readability when lots of other parameters present.
wikicode = '{{WikiProject banner shell' +
( newAssessment ? '|class=' + newAssessment : '' ) +
'|\n' +
'|1=\n' +
banners.join( '\n' ) +
'\n}}\n' +
wikicode;
Expand Down
28 changes: 14 additions & 14 deletions tests/test-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe( 'AFCH.addTalkPageBanners', function () {
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592485}}
}}`
);
Expand All @@ -150,7 +150,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592485}}
}}
Expand All @@ -172,7 +172,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592485}}
{{WikiProject Women}}
}}
Expand All @@ -193,7 +193,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592485}}
{{WikiProject Women}}
}}
Expand All @@ -212,7 +212,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592485}}
{{WikiProject Women}}
}}`
Expand All @@ -232,7 +232,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592507}}
{{WikiProject Women}}
{{WikiProject Women's sport}}
Expand All @@ -256,7 +256,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592507}}
{{WikiProject Women}}
{{WikiProject Women's sport}}
Expand All @@ -281,7 +281,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = 'Lazarut, Raluca';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592507}}
{{WikiProject Film}}
{{WikiProject Women}}
Expand All @@ -307,7 +307,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592507}}
{{WikiProject Women}}
{{WikiProject Women's sport}}
Expand All @@ -326,7 +326,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = 'Jones, Bob';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|class=B|
`{{WikiProject banner shell|class=B|1=
{{subst:WPAFC/article|oldid=592496}}
{{WikiProject Biography|living=yes|listas=Jones, Bob}}
{{WikiProject Africa}}
Expand All @@ -345,7 +345,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592496}}
{{WikiProject Biography|living=no|listas=}}
}}`
Expand All @@ -365,7 +365,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592496}}
{{WikiProject Somalia}}
}}`
Expand All @@ -382,7 +382,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|class=disambig|
`{{WikiProject banner shell|class=disambig|1=
{{subst:WPAFC/article|oldid=592681}}
{{WikiProject Disambiguation}}
}}`
Expand All @@ -400,7 +400,7 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
var subjectName = '';
var output = AFCH.addTalkPageBanners( wikicode, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName );
expect( output ).toBe(
`{{WikiProject banner shell|
`{{WikiProject banner shell|1=
{{subst:WPAFC/article|oldid=592681}}
{{OKA}}
}}
Expand Down

0 comments on commit d94dd9f

Please sign in to comment.