Wikipedia:AutoEd/htmltowikitext.js: Difference between revisions
Content deleted Content added
Add |
Fixes |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 1:
//Convert HTML to wikitext
function autoEdHTMLtoWikitext(str) {
// <b>
str = str.replace(/<
str = str.replace(/<
// </br>, <\br>, <br\>, <BR />, ...
str = str.replace(/
str = str.replace(/
// <.br>, <br.>, <Br>, ...
str = str.replace(/
// <br>>, <<br />, <<br >> ...
str = str.replace(/(<br[\s\/]*>)[\s]*>/gim, '$1');
// <hr>
str = str.replace(/([\r\n])[\t ]*<[\\\/\. ]*HR[\\\/\. ]*>/gi, '$1----');
// str = str.replace(/(.)<[\\\/\. ]*HR[\\\/\. ]*>/gi, '$1\n----'); // Breaks wikitables
▲ str = str.replace(/<[\\\/\s]*REFERENCES[\\\/\s]*>/gim, '<references />');
// Repeated references tag
str = str.replace(/(<references \/>)[\s]*\1/gim, '$1');
Line 38 ⟶ 37:
return str;
}
|