Wikipedia:AutoEd/headlines.js

//

 
function autoEdHeadlines(str) { //MAIN FUNCTION describes list of fixes
 
// Remove bold from section headings
var loopcount = 0;
while( str.search(/^[=]{1,5}[^=\r\n]*'''[^=\r\n]*[=]{1,5}/gim) >= 0 && loopcount <= 10 ) { //'
str = str.replace(/(^[=]{1,5}[^=\r\n]*)'''([^=\r\n]*[=]{1,5})[\t ]*/gim, '$1$2'); //'
loopcount++;
}
 
// Remove trailing colon from section headings
str = str.replace(/(^[=]{1,5}[^=\r\n]*)[:]([\t ]*[=]{1,5})[\t ]*/gim, '$1$2');
 
// Correct caps in "See also" section
str = str.replace(/(==[\t ]*)lihat pula([\t ]*==)/gi, "$1Lihat pula$2");
 
// Change common synonyms for "See also" to "See also", but only if "See also" doesn't exist
if( !str.match(/=[\t ]*See also[\t ]*=/gi) ) {
str = str.replace(/(==[\t ]*)(?:topik terkait|artikel terkait|pranala internal|lihat juga)([\t ]*==)/gi, "$1Lihat pula$2");
}
// Common synonyms for "External links"
str = str.replace(/(==[\t ]*)(?:pranala luar?|tautan luar?|web ?pranala?|pranala eksternal?)([\t ]*==)/gi, "$1Pranala luar$2");
 
// Capitalization and/or plural of "References", "Sources", "Further reading"
str = str.replace(/(==[\t ]*)referensi([\t ]*==)/gi, "$1Referensi$2");
str = str.replace(/(==[\t ]*)sumber([\t ]*==)/gi, "$1Sumber$2");
str = str.replace(/(==[\t ]*)bacaan lanjutan?([\t ]*==)/gi, "$1Bacaan lanjutan$2");
 
return str;
}
 
//