Skip to content

Commit

Permalink
only trim sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Dec 7, 2023
1 parent 190d13d commit 07e102d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/modules/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1585,9 +1585,12 @@
* @param {string} wikicode
*/
removeEmptySectionAtEnd: function ( wikicode ) {
wikicode = wikicode.replace( /(\n)==[^=]+==\n\s*?(\[\[Category:|$)/i, '$1$2' );
wikicode = wikicode.replace( /\n\n$/, '\n' );
return wikicode;
result = wikicode.replace( /(\n)==[^=]+==\n\s*?(\[\[Category:|$)/i, '$1$2' );
var headingWasRemoved = result !== wikicode;
if ( headingWasRemoved ) {
result = result.replace( /\n\n$/, '\n' );
}
return result;
},

/**
Expand Down

0 comments on commit 07e102d

Please sign in to comment.