User:Sbb/formatcitations.js: Difference between revisions

Content deleted Content added
 
Tweaked to not output a space between a template parameter and the '=' sign: "|param= ..."
 
Line 43:
tweakedTemplates[i] = tweakedTemplates[i].replace(/\n/g, "");
// Normalize spaces around the pipes and equal signs
tweakedTemplates[i] = tweakedTemplates[i].replace(/ *\| *([a-z1-9_-]+) *= */g," |$1 = ");
// Remove potencial extra spaces before template ends
tweakedTemplates[i] = tweakedTemplates[i].replace(/ *\}\}$/," }}");
Line 53:
var sum = document.editform.wpSummary;
var summary = vertical ? "convert citation templates to vertical format, for readability" : "harmonize whitespace in citation templates" ;
summary += " (using [[w:en:User:WaldirSbb/formatcitations.js|Regex citation formatter (forked, customized)]])";
if (sum.value.indexOf(summary) == -1) {
if (sum.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {