User:Novem Linguae/Scripts/DraftCleaner.js: Difference between revisions

Content deleted Content added
fix bug involving convertH1ToH2 adding an extra space (publish.php)
// Don't bold the title if it's already bolded. Fixes a "bold twice" bug. (publish.php)
Line 332:
titleToLookFor = titleToLookFor.replace(/ \(.*?\)$/, '');
titleToLookFor = this._escapeRegEx(titleToLookFor);
// Don't bold the title if it's already bolded. Fixes a "bold twice" bug.
let hasBoldedTitle = wikicode.match(new RegExp(`'''${titleToLookFor}'''`, 'i'));
if ( hasBoldedTitle ) return wikicode;
// Be pretty strict, to avoid adding ''' to image paths and infoboxes, which messes up the image. Also, only replace first match.
let regEx = new RegExp("^(The )?("+titleToLookFor+")([ <,])", "mi");