Skip to content

Commit 668a381

Browse files
DraftCleaner, SpeciesHelper: less enters in front of {{Stubs}}
to comply with new guidance at [[WP:STUBSPACING]]
1 parent 4ac95b5 commit 668a381

File tree

5 files changed

+6
-16
lines changed

5 files changed

+6
-16
lines changed

DraftCleaner/modules/DraftCleaner.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,10 @@ export class DraftCleaner {
400400
return wikicode.replace( /^\s*$/gm, '' );
401401
}
402402

403-
// no more than 2 newlines (1 blank line) in a row. except stubs, which get 3 newlines (2 blank lines)
403+
// no more than 2 newlines (1 blank line) in a row.
404404
// Note: AFCH does this too
405405
deleteMoreThanTwoEntersInARow( wikicode ) {
406406
wikicode = wikicode.replace( /\n{3,}/gm, '\n\n' );
407-
wikicode = wikicode.replace( /\n{2}(\{\{[^}]*stub\}\})/gi, '\n\n\n$1' );
408407
return wikicode;
409408
}
410409

DraftCleaner/tests/DraftCleaner.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ Test`;
13151315
expect( dc.deleteMoreThanTwoEntersInARow( wikicode ) ).toBe( output );
13161316
} );
13171317

1318-
test( 'Change 3 enters to 2 enters in front of a stub tag', () => {
1318+
test( 'Change 3 enters to 1 enter in front of a stub tag', () => {
13191319
const wikicode =
13201320
`Test
13211321
@@ -1325,20 +1325,18 @@ Test`;
13251325
const output =
13261326
`Test
13271327
1328-
13291328
{{Stub}}`;
13301329
expect( dc.deleteMoreThanTwoEntersInARow( wikicode ) ).toBe( output );
13311330
} );
13321331

1333-
test( 'Change 1 enters to 2 enters in front of a stub tag', () => {
1332+
test( 'Make no changes to 1 enter in front of a stub tag', () => {
13341333
const wikicode =
13351334
`Test
13361335
13371336
{{Stub}}`;
13381337
const output =
13391338
`Test
13401339
1341-
13421340
{{Stub}}`;
13431341
expect( dc.deleteMoreThanTwoEntersInARow( wikicode ) ).toBe( output );
13441342
} );

SpeciesHelper/modules/MOSOrderPositionFinder.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -703,11 +703,7 @@ export class MOSOrderPositionFinder {
703703

704704
// TODO: these are band aid fixes, they need a rewrite. should probably add the ideal # of blank lines beneath each section to the list of sections, and then do a foreach loop through that
705705
// if too much whitespace, reduce amount of whitespace
706-
if ( section === 'stubTemplates' ) {
707-
topHalf = topHalf.replace( /\n{4,}$/, '\n\n\n' );
708-
} else {
709-
topHalf = topHalf.replace( /\n{3,}$/, '\n\n' );
710-
}
706+
topHalf = topHalf.replace( /\n{3,}$/, '\n\n' );
711707
bottomHalf = bottomHalf.replace( /^\n{3,}/, '\n\n' );
712708

713709
if ( topHalf.endsWith( '\n\n' ) ) {

SpeciesHelper/modules/functions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,6 @@ export function deleteMoreThanTwoEntersInARow( wikicode ) {
711711

712712
// delete extra enters
713713
wikicode = wikicode.replace( /\n{3,}/gm, '\n\n' );
714-
wikicode = wikicode.replace( /\n{2}(\{\{[^}]*stub\}\})/gi, '\n\n\n$1' );
715714
return wikicode;
716715
}
717716

SpeciesHelper/tests/functions.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ Test`;
578578
expect( functions.deleteMoreThanTwoEntersInARow( wikicode ) ).toBe( output );
579579
} );
580580

581-
test( 'Change 3 enters to 2 enters in front of a stub tag', () => {
581+
test( 'Change 3 enters to 1 enter in front of a stub tag', () => {
582582
const wikicode =
583583
`Test
584584
@@ -588,20 +588,18 @@ Test`;
588588
const output =
589589
`Test
590590
591-
592591
{{Stub}}`;
593592
expect( functions.deleteMoreThanTwoEntersInARow( wikicode ) ).toBe( output );
594593
} );
595594

596-
test( 'Change 1 enters to 2 enters in front of a stub tag', () => {
595+
test( 'Make no change to 1 enter in front of a stub tag', () => {
597596
const wikicode =
598597
`Test
599598
600599
{{Stub}}`;
601600
const output =
602601
`Test
603602
604-
605603
{{Stub}}`;
606604
expect( functions.deleteMoreThanTwoEntersInARow( wikicode ) ).toBe( output );
607605
} );

0 commit comments

Comments
 (0)