Content deleted Content added
add deleteBlankLinesBetweenBullets() (publish.php) |
add fixWikilinksContainingURL() (publish.php) |
||
Line 7:
- Top uses:
- removes extra line breaks
- in the first sentence, bolds the title
- converts curly quotes to regular quotes
- puts <ref>s after periods
Line 180:
class DraftCleaner {
cleanDraft(wikicode, namespaceNumber, titleWithNamespaceAndSpaces) {
wikicode = this.fixWikilinksContainingURL(wikicode);
wikicode = this.deleteWeirdUnicodeCharacters(wikicode);
wikicode = this.trimEveryLine(wikicode);
Line 232 ⟶ 233:
// 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. -->
// delete <!-- Inline citations added to your article will automatically display here. See en.wikipedia.org/wiki/WP:REFB for instructions on how to add citations. -->
// remove <big></big> tags. test: == '''''<big>Saroj Kumar Basu</big>''''' ==, '''''<big>Saroj Kumar Basu</big>'''''
// in wikilinks, underscores to spaces
wikicode = this.trimEmptyLines(wikicode);
wikicode = this.deleteMoreThanTwoEntersInARow(wikicode);
Line 565 ⟶ 569:
deleteDuplicateReferencesSection(wikicode) {
// TODO:
return wikicode;
}
fixWikilinksContainingURL(wikicode) {
// non-piped wikilink
wikicode = wikicode.replace(/\[\[https?:\/\/en\.wikipedia\.org\/wiki\/([^|]*)\]\]/g, '[[$1]]');
// piped wikilink
wikicode = wikicode.replace(/\[\[https?:\/\/en\.wikipedia\.org\/wiki\/([^|]*)\|([^\]]*)\]\]/g, '[[$1|$2]]');
// non-piped external link
wikicode = wikicode.replace(/\[\[(http[^|]*)\]\]/g, '[$1]');
// piped external link
wikicode = wikicode.replace(/\[\[(http[^|]*)\|([^\]]*)\]\]/g, '[$1 $2]');
return wikicode;
}
|