User:Quarl/___location canonicalize.js: Difference between revisions

Content deleted Content added
prune null changes
〈33 words changed〉bf changes
Line 125:
if (wtext.match(c.regexp_substate)) {
var city = RegExp.$1, state = RegExp.$2;
 
++changes;
wfull = '[[' + wtext + '|' + city + ']]';
// only add link to state and country if we haven't yet mentioned them.
Line 133 ⟶ 131:
wfull += ', [['+state+']]';
}
++changes;
} else if (wtext.match(c.regexp_state)) {
// state link -- just need to add country link as necessary
Line 141 ⟶ 140:
 
if (left.match(c.regexp_country)) {
++changes;
// Already mentioned country. Delete redundant subsequent
// country links
right =if (right.replacematch(c.regexp_country_sq, '');) {
right = RegExp.rightContext;
// only count as a change if we actually delete it!
++changes;
++changes;}
} else {
// Haven't mentioned country earlier
Line 150 ⟶ 152:
// it's there already; good.
} else {
++changes;
// not there; add it.
wfull += ', ' + c.link_country;
++changes;
}
}