Jump to content

Wikipedia:AutoEd/extrabreaks.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by AFigureOfBlue (talk | contribs) at 19:27, 11 May 2009 (From User:Plastikspork/AutoEd/extrabreaks.js). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


//

 
function autoEdExtraBreaks(str) { //MAIN FUNCTION describes list of fixes
 
//Usually unneeded BR tags from ends of image descriptions and wikilinks (]]), templates (}}), template parameters (|)
str = str.replace(/[\t ]*<[\s\/\.]*br[\s\/\.]*>[\t ]*([\t\n ]*?)(\]\]|}}|\|)/gim, '$1$2');
//BR tag before a list item
str = str.replace(/[\t ]*<[\s\/\.]*br[\s\/\.]*>[\t ]*([\s]*?[\n]\*)/gim, '$1');
//BR tag followed by at least two newlines
str = str.replace(/[\t ]*<[\s\/\.]*br[\s\/\.]*>[\t ]*([\n])[\t ]*([\n])/gim, '$1$2');
 
return str;
}
 
//