跳至內容

維基百科:AutoEd/templates.js

維基百科,自由的百科全書

//

function autoEdTemplates(str) { //MAIN FUNCTION describes list of fixes

    //Replace redirects to Reflist with Reflist
    str = str.replace(new RegExp('\{\{REFERENCE|\{\{REFS|\{\{REFERENCE LIST|\{\{REFERENCES-SMALL|\{\{REFLINK|\{\{LISTAREF|\{\{REFERENCE LIST|\{\{REF-LIST', 'gi'), '\{\{Reflist');

    //Replace a long version of Reflist with Reflist
    str = str.replace(new RegExp('<div class=\'references-small\'>\n<references \/>\n<\/div>|<div class=\'references-small\'>\n<references\/>\n<\/div>', 'gi'), '\{\{Reflist\}\}');

    //Remove unneeded Template: text from transclusions
    str = str.replace(new RegExp('\{\{TEMPLATE:', 'gi'), '\{\{');

    return str;
}

//