User:Frietjes/addcheckforunknownparameters.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 46:
mytxt = mytxt.replace(/\|[\s]+/g, '|');
mytxt = mytxt.replace(/(\{\{[^\{\}\|]*)[\s]+(\||\}\})/g, '$1$2');
// Remove wikilinks to make patterns less complicated
mytxt = mytxt.replace(/\[\[[^\[\]\{\}]*\]\]/g, '');
// Add a leading and trailing newline to make pattern matches less complicated
mytxt = '\n' + mytxt + '\n';
Line 85 ⟶ 87:
var alphasort = confirm('Sort parameters alphabetically?');
// Sort
if(alphasort === true) {
plist.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()) });
aa = a.replace(/([^0-9])([0-9][^0-9]*)$/, '$10$2');
bb = b.replace(/([^0-9])([0-9][^0-9]*)$/, '$10$2');
return aa.toLowerCase().localeCompare(bb.toLowerCase()) });
} else {
plist = plist.sort(function(a,b) { return klist[a] - klist[b] } );