Wikipedia:AutoEd/htmltowikitext.js: Difference between revisions

Content deleted Content added
Remove per talk page
Per request
Line 1:
//Convert HTML to wikitext
function autoEdHTMLtoWikitext(str) {
// <b>, <strong>,and <i>, and <em> tags
str = str.replace(/<(B|STRONG)[ ]*>((?:[^<>]|<[a-z][^<>]*\/>|<([a-z]+)(?:| [^<>]*)>[^<>]*<\/\3>)*?)<\/\1[ ]*>/gi, "'''$21'''");
str = str.replace(/<(I|EM)[ ]*>((?:[^<>]|<[a-z][^<>]*\/>|<([a-z]+)(?:| [^<>]*)>[^<>]*<\/\3>)*?)<\/\1[ ]*>/gi, "''$21''");
// </br>, <\br>, <br\>, <BR />, ...
str = str.replace(/<[\\\/]+BR[\\\/\s]*>/gim, '<br />');