User:Qwerfjkl (bot)/code/7
Appearance
shortdesc = oldText.replace(/[\s\S]*\{\{ *[Ss]hort description *\| *(?:1\=)?([^\}]+)[\s\S]*/, '$1'); // Get SD
if (shortdesc == 'none' || shortdesc == 'None' || oldText.match(/\{\{ *[Ss]hort description *\|/) === null) {
return {text: false}; // skip if none, no change, or no SD
}
if (shortdesc.match(/^((Wiki[mp]edia )?list( article)?)$/i) != null) { // List SD, so convert to none
oldText = oldText.replace(new RegExp('([\\s\\S]*?)(\\n*)\\{\\{ *[Ss]hort description *\\| *'+shortdesc+' *\\}\\}\\n*'), '{{Short description|none}}\n$1\n'); // None SD, move SD to top
oldText = oldText.replace(/([\s\S]*?\n*\{\{ *[Ss]hort description *\|none\}\})\n*/, '$1\n'); // fix newline issue
summ = 'Changing short description "'+shortdesc+'" to "none" per [[WP:SDNONE]] (via [[de:Benutzer:Schnark/js/bandersnatch|Bandersnatch]])';
return {text: oldText, bot: true, summary: summ};
}