Content deleted Content added
〈"*(" → "(", "+state+ " → "\\[\\[ +state+ \\]\\]"〉 |
〈80 words changed〉canonicalizeString; special-case infoboxes |
||
Line 21:
var result = '';
var input = editor.wpTextbox1;
// special case the first Infobox, if there is one
if (input.match(/^{{Infobox(.|\n)*?\n}}/)) {
// var left = RegExp.leftContext;
var infobox = RegExp.lastMatch;
var right = RegExp.rightContext;
// treat the infobox separately, so that USA links get added to main
// article.
result = (this.canonicalizeString(infobox, changes) +
this.canonicalizeString(right, changes));
} else {▼
result = this.canonicalizeString(input, changes);
}▼
if (changes.length) {
editor.wpTextbox1 = result;▼
editor.wpSummary = '___location canonicalization: ' + changes.join(', ');▼
editor.wpMinoredit = true;▼
editor.submit('wpDiff');▼
} else {
alert("No changes to make!");▼
}
}
location_canonicalize.canonicalizeString = function(input, changes) {
var result = '';
var changes = [];
Line 44 ⟶ 72:
}
result += input;
return result;
▲ if (changes.length) {
▲ editor.wpTextbox1 = result;
▲ editor.wpSummary = '___location canonicalization: ' + changes.join(', ');
▲ editor.wpMinoredit = true;
▲ editor.submit('wpDiff');
▲ } else {
▲ alert("No changes to make!");
▲ }
}
|