Wikipedia:AutoEd/whitespace.js: Difference between revisions
Content deleted Content added
Plastikspork (talk | contribs) Per talk page |
Plastikspork (talk | contribs) Per request on talk page, fix for spacing before stub templates (should work) |
||
Line 4:
str = str.replace(/\t/g, " ");
str = str.replace(/^ ? ? \n/gm, "\n");
str = str.replace(/(\n\n)\n+/g, "$1");▼
// Extra newlines
if(str.search(/\uE000/g) < 0) { // see [[Private Use Area]]
// Mark spacing before stub templates
str = str.replace(/(\n)[ \t]*(\n)[ \t]*(\n\{\{[^{}]*\-stub\}\})/gm, '$1\uE000$2\uE000$3');
str = str.replace(/(\n)[ \t]*(\n\{\{[^{}]*\-stub\}\})/gm, '$1\uE000$2');
// Remove extra newlines
▲ str = str.replace(/(\n\n)\n+/g, "$1");
// Unmark
str = str.replace(/\uE000/g, '');
}
// str = str.replace(/== ? ?\n\n==/g, "==\n==");
str = str.replace(/\n\n(\* ?\[?http)/g, "\n$1");
|