User:Ohconfucius/script/formatgeneral.js: Difference between revisions

Content deleted Content added
Revert to revision 846168377 dated 2018-06-16 20:27:57 by Ohconfucius using popups
Revert to revision 895247207 dated 2019-05-02 23:30:59 by Ohconfucius using popups
Line 32:
 
//add correct hyphenation
regex(/\b([2-9]|\d{2,3}|half|quarter|two|three|four|five|six|seven|eight|nine|ten) (second|minute|hour|day|week|month|year|decade|fold|liter|litre|degree|pound|inch|foot|yard|mile|meter(?:kilo|)met(?:re|metreer)|man|page|point|word|dollar|cent|floor|store?y|(?:bed|)room)\b/g, "$1-$2");
regex(/\b([2-9]|\d{2,3}|two|three|four|five|six|seven|eight|nine|ten)-(second[- ]class)\b/g, "$1 $2"); //palliative to reverse incorrectly inserted hyphen "n-second-class"
regex(/\b(two|three|four|five|six|seven|eight|nine|ten) (halves|thirds|quarters|(?:four|fif|six|seven|eigh|nin|ten)ths)\b/gi, "$1-$2");
Line 538:
regex(/(Chief (Executive|Financial|Operating|Information|Marketing) Officer)/g, '{{' + 'subst:' + 'lc:$1}}');
// regex(/C(hief Executive)(?=\W)/g, 'C{{' + 'subst:' + 'lc:$1}}');
regex(/M(anaging )D(irector)(?=\W)/g, 'm$1d$2');
regex(/G(eneral )M(anager\b)(?!of|[ ]*=)/g, 'g$1m$2');
Line 681:
//add {{url}} template to infobox parameter
regex(/({{) ?(url) ?(?=\|)/gi, '$1$2');
regex(/({{url\|)[ ]*(?:https?:\/\/|)((?:www\.|)([^\}]+}})[ ]*(?=[\n\r])/gi, '$1$2');
regex(/({{url\|)(?:https?:\/\/|)((?:www\.|)([^\}]+)\|(?:\2|Official (?:web|)site)}}(?=[\s])/gi, '$1$2}}');
regex(/(\| ?homepage[ ]*=)[ ]*https?:\/\/(?:www\.|)([^\s\[\]]+)(?=[\s])/gi, '$1{{url|$2}}'); //rem 'website='
regex(/(\| ?(?:homepage|website)[ ]*=)[ ]*\[https?:\/\/(www\.|)([^\s\[\]]+) \2\3\](?=[\s])/gi, '$1{{url|$3}}');
Line 774:
regex(/(\{\{\w*)([^\|=\[\]]*)(\}\})/gi, protect_function);
regex(/(<ref name=)([^<>]*)(>)/gi, protect_function);
regex(/(Convoy(?:&nbsp;|\s))(\w{2,3}(?:&nbsp;|\s)\d\d(?:&nbsp;|\s)?\w{2,3})(.)/gi, protect_function);
regex(/(\{Infobox)( non Test)( cricket)/gi, protect_function);
regex(/(\d[]*)(Cr App R)(.)/g, protect_function);