Skip to content

Commit

Permalink
remove extra line breaks between banners
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Aug 22, 2024
1 parent 9dd2b4c commit 7c581e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/modules/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,9 @@
}
}

// Remove extra line breaks between banners
talkText = talkText.replace( /\}\}\n{2,}\{\{/g, '}}\n{{' );

return {
talkText: talkText,
countOfWikiProjectsAdded: wikiProjectsToAdd.length,
Expand Down
5 changes: 0 additions & 5 deletions tests/test-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
expect( output.talkText ).toBe(
`{{WikiProject banner shell|
{{subst:WPAFC/article|oldid=592507}}
{{WikiProject Women}}
{{WikiProject Women's sport}}
{{WikiProject Somalia}}
Expand Down Expand Up @@ -255,7 +254,6 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
expect( output.talkText ).toBe(
`{{WikiProject banner shell|
{{subst:WPAFC/article|oldid=592507}}
{{WikiProject Women}}
{{WikiProject Women's sport}}
{{WikiProject Somalia}}
Expand All @@ -266,7 +264,6 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
expect( output.bannerCount ).toBe( 4 );
} );

// FIXME: the edit summary of 1 WikiProject banner removed is correct, but this doesn't actually remove the WikiProject banner from the talk page. https://github.com/wikimedia-gadgets/afc-helper/issues/329
it( 'remove an existing WikiProject', function () {
var talkText =
`{{WikiProject Women}}
Expand Down Expand Up @@ -302,7 +299,6 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
expect( output.talkText ).toBe(
`{{WikiProject banner shell|
{{subst:WPAFC/article|oldid=592507}}
{{WikiProject Women}}
{{WikiProject Women's sport}}
{{WikiProject Somalia}}
Expand Down Expand Up @@ -395,7 +391,6 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
expect( output.talkText ).toBe(
`{{WikiProject banner shell|
{{subst:WPAFC/article|oldid=592496}}
{{wikiproject biography|living=yes|listas=Jones, Bob}}
{{WikiProject Somalia}}
}}`
Expand Down

0 comments on commit 7c581e6

Please sign in to comment.