Content deleted Content added
fix bug involving extra spaces in heading (publish.php) |
add deleteNoWikiTags(), couple of bug fixes (publish.php) |
||
Line 1:
// <nowiki>
/
- Adds "Run DraftCleaner" link to the left sidebar
- Top uses:
- removes extra line breaks
- bolds the title
- More detailed list of uses:
- converts [inline external links] to <ref>s
- reduces more than 2 enters in a row, to 2 enters
- removes spaces in front of <ref>s
- get rid of any level 2 heading that contains the article's title
-
-
-
-
-
-
- remove self wikilinks to the article title
- convert ==Reference== to ==References==
Line 207 ⟶ 211:
wikicode = this.deleteEmptySections(wikicode);
wikicode = this.fixHeadingsInAllCaps(wikicode);
wikicode = this.deleteDuplicateReferencesSection(wikicode);
wikicode = this.deleteNoWikiTags(wikicode);
// delete empty sections. for example, empty ==See Also== section
// all ==sections== should start with a capital letter
Line 220 ⟶ 226:
// duplicate citation fixer
// move refs that are below {{Reflist}}, to above {{Reflist}}
// move refs out of headings
// delete AFC submission templates located mid-article, they end up self-hiding then appear as inexplicable whitespace. example: {{AfC submission|t||ts=20211212134609|u=Doezdemir|ns=118|demo=}}<!-- Important, do not remove this line before article has been created. -->
wikicode = this.trimEmptyLines(wikicode);
wikicode = this.deleteMoreThanTwoEntersInARow(wikicode);
Line 272 ⟶ 280:
headingNameToLookFor = headingNameToLookFor.replace(/^Draft:/, '');
headingNameToLookFor = this._escapeRegEx(headingNameToLookFor);
let regEx = new RegExp("^== ?"+headingNameToLookFor+"
wikicode = wikicode.replace(regEx, "");
// now look for titles that contain Draft: at the beginning, too
headingNameToLookFor = titleWithNamespaceAndSpaces;
headingNameToLookFor = this._escapeRegEx(headingNameToLookFor);
regEx = new RegExp("^== ?"+headingNameToLookFor+"
wikicode = wikicode.replace(regEx, "");
return wikicode;
Line 303 ⟶ 311:
titleToLookFor = this._escapeRegEx(titleToLookFor);
// Be pretty strict, to avoid adding ''' to image paths and infoboxes, which messes up the image.
let regEx = new RegExp("^(The )?("+titleToLookFor+")([
wikicode = wikicode.replace(regEx, "$1'''$2'''$3");
}
Line 425 ⟶ 433:
let draft = (namespace == 118);
if ( draft ) {
wikicode = wikicode.replace(/:?(\[\[)(Category:[^\]]*\]\])/gm, '$1:$2');
}
return wikicode;
Line 549 ⟶ 557:
// TODO:
return wikicode;
}
deleteDuplicateReferencesSection(wikicode) {
// TODO:
return wikicode;
}
deleteNoWikiTags(wikicode) {
return wikicode.replace(/<\/?nowiki>/g, '');
}
|