Revision as of 10:14, 29 September 2013 view sourceOhconfucius (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers328,947 edits tweet case sentivity← Previous edit |
Latest revision as of 21:05, 13 November 2024 view source Ohconfucius (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers328,947 edits IUPAC spellings |
(515 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
|
|
// <syntaxhighlight lang=javascript> |
|
function Ohc_formats() { |
|
|
|
// ********************************************************************************************* |
|
|
|
|
|
//This is a test (non-production) script, and may have untested errors. Please exercise due care should you decide to use it. |
|
|
|
|
|
// ********************************************************************************************* |
|
|
|
|
|
/** |
|
|
* Replicates a legacy function used by the regex menu framework for scripts |
|
|
* migrated to the newer TemplateScript. |
|
|
*/ |
|
|
function regex(search,replace,repeat) { |
|
|
var editbox = $('#wpTextbox1'); |
|
|
|
|
|
/* define how many times to perform */ |
|
|
if(!repeat || repeat<0) { |
|
|
var repeat = 1; |
|
|
} |
|
|
|
|
|
/* perform */ |
|
|
var text = editbox.val(); |
|
|
for(var i=0; i<repeat; i++) { |
|
|
text = text.replace(search,replace); |
|
|
} |
|
|
editbox.val(text); |
|
|
}; |
|
|
|
|
|
function Ohc_format_Sundry() { |
|
var txt=document.editform.wpTextbox1; |
|
var txt=document.editform.wpTextbox1; |
|
|
|
|
Line 5: |
Line 32: |
|
regex(/\*_\d{4}#\d{4}_*_\d\d?\|(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))( \d\d?)\]\]/g, '$1$2'); |
|
regex(/\*_\d{4}#\d{4}_*_\d\d?\|(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))( \d\d?)\]\]/g, '$1$2'); |
|
// regex(/<br>/gi, '<br/>'); |
|
// regex(/<br>/gi, '<br/>'); |
|
regex(/(\d)(?:<(?:small|sup)>){2}(th|st|nd|rd)(?:<\/(?:small|sup)>){2}/gi, '$1$2'); |
|
regex(/(\d)(<sup>)(m)(\d<\/sup>)/gi, '$1$3$2$4'); //misplaced unit (squared)il |
|
regex(/(\d)<(?:small|sup)>(th|st|nd|rd)(?:<\/(?:small|sup)>|<(?:small|sup)\/>)/gi, '$1$2'); |
|
|
|
|
|
|
//rem linking within section headings |
|
//rem linking within section headings |
|
regex(/(==?(?:*|))\]+?)\]\]((?:*|)?==)/gi, '$1$2$3'); |
|
regex(/(==?(?:*))\]+?)\]\]((?:*|)?==)/gi, '$1$2$3'); |
|
regex(/(==?(?:*|))\]+?\|(]+?)\]\]((?:*|)?==)/gi, '$1$2$3'); |
|
regex(/(==?(?:*))\]+?\|(]+?)\]\]((?:*|)?==)/gi, '$1$2$3'); |
|
regex(/(==?(?:*|))\]+?\||)(]+?)\]\](*)\]+?\||)(]+?)\]\](?:(*)\]+?\||)(]+?)\]\]|)((?:*|)?==)/gi, '$1$2$3$4$5$6$7'); |
|
regex(/(==?(?:*))\]+?\||)(]+?)\]\](*)\]+?\||)(]+?)\]\](?:(*)\]+?\||)(]+?)\]\]|)((?:*|)?==)/gi, '$1$2$3$4$5$6$7'); |
|
regex(/(==?)\d{1,2}px(]+?)((?:*|)?==)/gi, '$1$2$3'); //rem artefact after removing file from title |
|
// regex(/(==?)\d{1,2}px(]+?)((?:*|)?==)/gi, '$1$2$3'); //rem artefact after removing file from title |
|
|
|
|
|
//rem refs within section headings |
|
|
regex(/(==?(?:*))(?:<ref(?:>*<\/ref| name=+\/)>)(*)(?=?==)/gi, '$1$2'); |
|
|
|
|
|
//rem empty parameters |
|
//rem empty parameters |
|
// regex(/\|***=*?*(?=)/g, ""); |
|
// regex(/\|***=*?*(?=)/g, ""); |
|
|
|
|
|
//rem deprecated parameters |
|
//rem deprecated parameters |
|
regex(/\|\s*influence\s*=*(?=)/g, ""); //rfc infobox person July 2013 |
|
// regex(/\|\s*influence\s*=*(?=)/g, ""); //rfc infobox person July 2013; code fails if there are piped links |
|
|
regex(/({{(?:end|start)date)\|df=y(?:es|)/gi, "$1"); //rem deprecated parameter |
|
|
regex(/({{(?:end|start)date(?:*))\|df=y(?:es|)(}})/gi, "$1$2"); //rem deprecated parameter |
|
|
regex(/\| ?(?:tele|)phone numbers?= ?(*)(?=)/gi, ""); |
|
|
|
|
|
//add correct hyphenation |
|
//add correct hyphenation |
|
regex(/\b(|\d{2,3}|half|quarter|two|three|four|five|six|seven|eight|nine|ten) (minute|hour|day|week|month|year|litre|litre|degree|inch|foot|yard|mile|metre|metre|man|page|point|word|dollar|cent|floor|store?y|room)\b/g, "$1-$2"); |
|
regex(/\b(|\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|(?:kilo|)met(?:re|er)|man|page|point|word|dollar|cent|floor|store?y|(?:bed|)room)\b/g, "$1-$2"); |
|
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"); |
|
regex(/\b(|\d{2,3}|two|three|four|five|six|seven|eight|nine|ten)-(secondclass)\b/g, "$1 $2"); //palliative to reverse incorrectly inserted hyphen "n-second-class" |
|
regex(/\b((?:|\d{2,3})-(?:month|year)) (old)\b/gi, "$1-$2"); |
|
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"); |
|
|
regex(/\b((?:|\d{2,3})-(?:month|year)) (old)\b/gi, "$1-$2"); |
|
regex(/(\bnon) (?+)/g, "$1-$2"); |
|
regex(/(\bnon) (?+)/g, "$1-$2"); |
|
|
regex(/(\bnon)-(grata)/g, "$1 $2"); //reinstate for "persona non grata" |
|
|
regex(/(qua non)-()/gi, "$1 $2"); //reinstate for "sine qua non" |
|
|
regex(/(etween \d{4})\s?\s?(\d{4})/g, "$1 and $2"); //ungrammatical constructs involving year ranges" |
|
|
regex(/(etween (\d{2})\d{2})\s?\s?(\d{2})/g, "$1 and $2$3"); //ungrammatical constructs involving year ranges" |
|
|
regex(/(rom \d{4})\s?\s?(\d{4})/g, "$1 to $2"); //ungrammatical constructs involving year ranges" |
|
|
regex(/(rom (\d{2})\d{2})\s?\s?(\d{2})/g, "$1 to $2$3"); //ungrammatical constructs involving year ranges" |
|
|
regex(/(\| ?colou?rs?= ?+)&(+)(?=)/gi, "$1and$2"); |
|
|
|
|
|
|
regex(/(?:\| ?date= ?)(Cric\w{4,})(?=)/gi, "|publisher=$1"); |
|
|
// regex(/\{\{color ?(?:box|sample)\s?\|+\}\}(*|)\{\{color ?(?:box|sample)\s?\|+\}\}(*|)\{\{color ?(?:box|sample)\s?\|+\}\}(*|)/gi, "$1$2$3"); |
|
|
// regex(/\{\{color ?(?:box|sample)\s?\|+\}\}(*|)\{\{color ?(?:box|sample)\s?\|+\}\}(*|)/gi, "$1$2"); |
|
|
// regex(/(\|\s*(?:\w+_|)colou?rs\s*=\s**)\{\{color ?(?:box|sample)\s?\|+\}\}(*|)(?=\n?)/gi, "$1$2"); |
|
|
|
|
|
} |
|
|
|
|
|
function Ohc_format_MOSCAPS(){ |
|
|
//WP:AMPERSAND |
|
|
regex(/(==** )&( *)(?=*=)/g, '$1and$2'); |
|
|
regex(/(\|\s*(?:\w+_|)colou?rs\s*=\s*+)& (\w+)/gi, '$1and $2'); //replace ampersand |
|
|
|
|
//improper capitalisation within section headings |
|
//improper capitalisation within section headings |
|
regex(/(==*External )(Links)(?=*=)/g, '$1links'); |
|
regex(/(==*External )(Links)(?=*=)/g, '$1links'); |
|
regex(/(==*See )(Also)(?=*=)/g, '$1also'); |
|
regex(/(==*See )(Also)(?=*=)/g, '$1also'); |
|
|
regex(/(==*)Notable Alumnae/g, '$1Alumni'); |
|
regex(/(==*)Notable (\w*?)/g, '$1$2'); |
|
regex(/(==*)Notable (\w*?)/g, '$1$2'); |
|
regex(/(==*Box )O(ffice)(?=*=)/g, '$1o$2'); |
|
regex(/(==*Box )O(ffice)(?=*=)/g, '$1o$2'); |
|
regex(/(==*+? and )A(wards?|chievements?)(?=*=)/g, '$1a$2'); |
|
regex(/(==*+? and )A(wards?|chievements?)(?=*=)/g, '$1a$2'); |
|
regex(/(==*+? )C(areer|hampionships|haracters|ompositions)(?=*=)/g, '$1c$2'); |
|
regex(/(==*+? )A(lbums?)(?=*=)/g, '$1a$2'); |
|
|
regex(/(==*+? )C(areer|haracters|hart|ompetitions?|ompositions|redits)(?=*=)/g, '$1c$2'); |
|
|
regex(/(==*+? )(Capped layers)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(==*\w+ )((?:\w+ |and |)Destinations?)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/(==*+? )E(ducation)(?=*=)/g, '$1e$2'); |
|
regex(/(==*+? )E(ducation)(?=*=)/g, '$1e$2'); |
|
// regex(/(==*+? )G(roup)(?=*=)/g, '$1g$2'); |
|
regex(/(==*+? )F(acilities|ilms?)(?=*=)/g, '$1f$2'); |
|
regex(/(==*+? )H(istory|onou?rs)(?=*=)/g, '$1h$2'); |
|
// regex(/(==*+? )G(roups?)(?=*=)/g, '$1g$2'); |
|
regex(/(==*+? )L(evel|ife|isting)(?=*=)/g, '$1l$2'); |
|
regex(/(==*+? )L(evels?|ife|istings?)(?=*=)/g, '$1l$2'); |
|
regex(/(==*(?:1st|2nd|3rd|\dth) )M(atch)/g, '$1m$2'); |
|
regex(/(==*+? )M(ember(?:ship|s?))(?=*=)/g, '$1m$2'); |
|
regex(/(==*(?:1st|2nd|3rd|\dth) )F(inal)/g, '$1f$2'); |
|
regex(/(==*+? )P(oll(?:ing|s?))(?=*=)/g, '$1p$2'); |
|
regex(/(==*(?:First|Second|Third|Fourth|(?:st|nd|rd|th)) )P(lace)(?=*==)/g, '$1p$2'); |
|
|
regex(/(==*(?:First|Second|Third|Fourth|(?:st|nd|rd|th)) )Q(uarter)(?=*==)/g, '$1q$2'); |
|
|
regex(/(==*(?:First|Second|Third|Fourth|(?:st|nd|rd|th)) )R(ound)(?=*==)/g, '$1r$2'); |
|
|
regex(/(==*(?:CFL|NL) )C(oaching )(ecords?)(?=*=)/g, '$1c$2r$3'); |
|
|
regex(/(==*+? )R(ankings?|eading|esults?|ecords?|eception|ecognition)(?=*=)/g, '$1r$2'); |
|
regex(/(==*+? )R(ankings?|eading|esults?|ecords?|eception|ecognition)(?=*=)/g, '$1r$2'); |
|
regex(/(==*+? )C(areer )S(tatistics)(?=*=)/g, '$1c$2s$3'); |
|
regex(/(==+) +S((?:chedule|creenings?|ummary) ?==)/gi, '$1 s$2'); |
|
regex(/(==*+? )S(eason|quad|tyle|tage|tatistics)(?=*=)/g, '$1s$2'); |
|
regex(/(==*+? )T(ables?|ournaments|ransport(?:ations?|))(?=*=)/gi, '$1t$2'); |
|
regex(/(==*+? )T(ournaments?)(?=*=)/g, '$1t$2'); |
|
regex(/(==*+? )W(inners)(?=*=)/g, '$1w$2'); |
|
regex(/(==*+? )Y(ears)(?=*=)/g, '$1y$2'); |
|
regex(/(==*+? )Y(ears)(?=*=)/g, '$1y$2'); |
|
|
|
|
|
|
|
regex(/(==*Exhibition )S(chedule)(?=*=)/g, '$1s$2'); |
|
regex(/(==*Performance )(By \w+)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/(==*Regular )Season Schedule(?=*=)/g, '$1season schedule'); |
|
regex(/(==*Extra )(Preliminary Round)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/(==*Right )f Reply(?=*=)/g, '$1of reply'); |
|
regex(/(==*Extended )(Playing Squad)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/(==*Terminated )D(estinations)(?=*=)/g, '$1d$2'); |
|
regex(/(==*Wider )(Training roup)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/(==*Twin )T(owns)(?=*=)/g, '$1t$2'); |
|
regex(/(==*Regular )(Season chedule)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/(==*Twin )(Towns nd ister ities)(?=*=)/g, '$1towns and sister cities'); |
|
regex(/(==*Right )(f Reply)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(==*Twin )(Towns(?: nd ister ities|))(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/(==*Heraldic )(Items)(?=*=)/g, '$1items'); |
|
regex(/(==*Heraldic )(Items)(?=*=)/g, '$1items'); |
|
regex(/(==*Campaign )C(redits)(?=*=)/g, '$1c$2'); |
|
regex(/(==*Campaign )C(redits)(?=*=)/g, '$1c$2'); |
|
regex(/(==*Combat )C(hronicle)(?=*=)/g, '$1c$2'); |
|
regex(/(==*Combat )C(hronicle)(?=*=)/g, '$1c$2'); |
|
|
regex(/(==*+? )(International Trips)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
|
|
|
regex(/(\|\s*(?:\w+_|)colou?rs\s*=\s*)(+)(?=)/gi, '$1{{' + 'subst:' + 'lc:$2}}'); //downcase colours in infobox |
|
|
regex(/(\|\s*(?:\w+_|)colou?rs\s*=\s*+)&(+)/gi, '$1and$2'); //replace ampersand |
|
|
|
|
|
|
regex(/(==\w+) M(atch(?:es|))\b/gi, '$1 m$2'); |
|
//other improper capitalisation |
|
|
|
regex(/(==\w+)B(acks?)\b/gi, '$1-b$2'); |
|
|
regex(/(==\w+)E(ight)/gi, '$1-e$2'); |
|
|
regex(/(==(?:Top|Bottom))H(alf)\b/gi, '$1 h$2'); |
|
|
regex(/(==(?:Scrum|Fly))H(alf|alves)\b/gi, '$1-h$2'); |
|
|
regex(/(==\w+)Q(uarters?)\b/gi, '$1-q$2'); |
|
|
|
|
|
// within links and pipes |
|
|
regex(/((?:'''|\|)(?:alf|ull))B(acks?(?:'''|\]\]))/gi, '$1 b$2'); |
|
|
regex(/((?:'''|\|)\w+)F(orwards?(?:'''|\]\]))/gi, '$1 f$2'); |
|
|
regex(/((?:'''|\|)(?:ne|hree|our||ive))E(ights?(?:'''|\]\]))/gi, '$1-e$2'); |
|
|
regex(/((?:'''|\|)\w+)H((?:alf|alves)(?:'''|\]\]))/gi, '$1-h$2'); |
|
|
regex(/((?:'''|\|)(?:ne|hree|our))Q(uarters?(?:'''|\]\]))/gi, '$1-q$2'); |
|
|
regex(/((?:'''|\|) ?Player )(One|Two|Three|Four)/gi, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/((?:'''|\|)Population)D(ensity(?:'''|\s?\|))/gi, '$1 d$2'); |
|
|
regex(/((?:'''|\|)Population)P(rojection(?: \w+|)(?:'''|\s?\|))/gi, '$1 p$2'); |
|
|
regex(/(\]+\|National )P(arty\]\])/g, '$1p$2'); |
|
|
|
|
|
regex(/(*\])/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/((?:*|\s)\])/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/\b(Armenian|Assyrian|Cambodian|Darfur|Dzungar|East Timor|Greek|Herero and Namaqua|Rwandan) G(enocide)\b/g, '$1 g$2'); |
|
|
regex(/(\+ )(?:+ )*)(Conspiracy|Controversy|(?:Race |)Riot|Massacre|Murder|Protest|Uprising)(?=s?(?: of \d{3,4}|)\]| \(\d{3,4}\))/g, '$1{{' + 'subst:' + 'lc:$2}}'); //per Frietjes: you cannot use subst: inside of references |
|
|
|
|
|
//improper capitalisation within infobox strings |
|
|
regex(/(, |\band )A(cademic|ctor|ctress|ctivist|nimator|rranger|rtist|rt critic|strologer|thlete|uthor)(?= ?)/g, '$1a$2'); |
|
|
regex(/(, |\band )B(allet|iography|roadcaster|usiness(?:wo|)man)(?= ?)/g, '$1b$2'); |
|
|
regex(/(, |\band )C(hef|olumnist|o-\w+|omedian|omposer|onsultant|ritic|urator)(?= ?)/g, '$1c$2'); |
|
|
regex(/(, |\band )D(entist|esigner|j|irector|is jockey|ocumentary maker|ramatist)(?= ?)/g, '$1d$2'); |
|
|
regex(/(, |\band )E(ditor|ditorinchief|ducator|ngineer|ntertainer|ntrepreneur|nvironmentalist|ssayist|xecutive producer|xplorer)(?= ?)/g, '$1e$2'); |
|
|
regex(/(, |\band )F(ashion (?:designer|model)|iction|ilm(?: critic|director|?maker|producer))(?= ?)/g, '$1f$2'); |
|
|
regex(/(, |\band )G(raphic designer)(?= ?)/g, '$1g$2'); |
|
|
regex(/(, |\band )H(acker|istorian|istorical fiction)(?= ?)/g, '$1h$2'); |
|
|
regex(/(, |\band )J(ournalist)(?= ?)/g, '$1j$2'); |
|
|
regex(/(, |\band )L(awyer|eader|ecturer|ibrarian|iterary editor|yricist)(?= ?)/g, '$1l$2'); |
|
|
regex(/(, |\band )M(ayor|athematician|odel|usician|ulti-instrumentalist)(?= ?)/g, '$1m$2'); |
|
|
regex(/(, |\band )M(usic (?:arranger|composer|critic|director|producer))(?= ?)/g, '$1m$2'); |
|
|
regex(/(, |\band )N(arrator|ovelist)(?= ?)/g, '$1n$2'); |
|
|
regex(/(, |\band )O(rator)(?= ?)/g, '$1o$2'); |
|
|
regex(/(, |\band )P(erformance artist|erformer|hilosopher|hilosophy|hotographer|laywright|oet|oetry|olitical activist|olitician|laywright|riest|resenter|roducer|rofessor|olitical commentator|ublic speaker|ublicist|ublisher|undit)(?= ?)/g, '$1p$2'); |
|
|
regex(/(, |\band )R(ecord producer|eporter)(?= ?)/g, '$1r$2'); |
|
|
regex(/(, |\band )S(ailor|cholar|cientist|creenwriter|culptor|oldier|olicitor|inger.songwriter|ong-?writer|peaker|tockbroker)(?= ?)/g, '$1s$2'); |
|
|
regex(/(, |\band )S(tand?up) C(omed(?:ian|))(?= ?)/g, '$1s$2 c$3'); |
|
|
regex(/(, |\band )T(eacher|elevision|heatr(?:e|ical) (?:critic|director|producer)|ranslator)(?= ?)/g, '$1t$2'); |
|
|
regex(/(, |\band )V(oice actor)(?= ?)/g, '$1v$2'); |
|
|
regex(/(, |\band )W(riter)(?= ?)/g, '$1w$2'); |
|
|
|
|
|
//rem inappropriate |
|
|
regex(/((?:occupation|profession)*=*\w+) & (\w+)/gi, '$1, $2'); |
|
|
regex(/((?:occupation|profession)*=*)(?:, (?:activ|philanthrop)ist|Member of Parliament)(?=*\n*\|)/gi, '$1'); |
|
|
// regex(/((?:occupation|profession)*=*)(?:\\])(?=*\n*\|)/gi, '$1Politican'); |
|
|
regex(/((?:occupation|profession)*=*)(?:(?:\]+\||)Member of Parliament\]\])(?=*\n*\|)/gi, '$1Politican'); |
|
|
regex(/((?:focus|instrument|industry|known for|method|occupation|products|profession)*=*+)(++)(?=\n*\|)/gi, '$1{{' + 'subst:' + 'lc:$2}}'); //to genericise downcasing of occupations and musical instruments |
|
|
regex(/(?:activ|philanthrop)ist, (politician|businessman)(?=*\n*\|)/gi, '$1'); |
|
|
regex(/(?:Activ|Philanthrop)ist, ()(olitician|usinessman|awyer)/g, '{{' + 'subst:' + 'uc:$1}}$2'); |
|
|
|
|
|
//other improper capitalisation -sports |
|
|
regex(/((?:==?|\||\()*+? )H(eld|istory|onou?rs)(?=*=)/g, '$1h$2'); |
|
|
regex(/((?:==?|\||\()*(?:1st|2nd|3rd|\dth) )M(atch)/g, '$1m$2'); |
|
|
regex(/((?:==?|\||\()*(?:1st|2nd|3rd|\dth) )F(inal)/g, '$1f$2'); |
|
|
regex(/((?:==?|\||\()*(?:First|Second|Third|Fourth|(?:st|nd|rd|th)) )Q(uarter)/g, '$1q$2'); |
|
|
regex(/((?:==?|\||\()*(?:First|Second|Third|Fourth|(?:st|nd|rd|th)) )R(ound)/g, '$1r$2'); |
|
|
regex(/(\W+ )(uarter)F(inal)/g, '$1q$2-f$3'); |
|
|
regex(/((?:==?|\||\()*uarter|emi)?F(inal)/gi, '$1-f$2'); |
|
|
regex(/(\W+ )(emi)F(inal)/g, '$1s$2-f$3'); |
|
|
regex(/(==*Overall )(Team ecords?)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(==*(?:CFL|NL) )C(oaching )(ecords?)(?=*=)/g, '$1c$2r$3'); |
|
|
regex(/(==*+? )C(areer )S(tatistics)(?=*=)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(==*+? (?:and |& |))S(eason|quad|tyle|taff|tage|tatistics)(?=*=)/g, '$1s$2'); |
|
regex(/\b(Bowling |Batting )S(tyle)\b/g, '$1s$2'); |
|
regex(/\b(Bowling |Batting )S(tyle)\b/g, '$1s$2'); |
|
regex(/\b(lef|righ)t-Handed Opening B(atsman)\b/gi, '$1t-handed opening b$2'); |
|
regex(/\b(ight|eft)-(anded(?: (?:Opening|Top rder) Batsman|))\b/gi, '$1-{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/\b(lef|righ)t-Handed Top Order B(atsman)\b/gi, '$1t-handed top-order b$2'); |
|
|
regex(/\b(ll)R(ounder)\b/gi, '$1-r$2'); |
|
regex(/\b(ll)R(ounder)\b/gi, '$1-r$2'); |
|
regex(/\b(Wicket)K(eeper)\b/gi, '$1-k$2'); |
|
regex(/\b(Wicket)K(eeper)\b/gi, '$1-k$2'); |
|
|
regex(/(ight|eft)(rm (?:\]+\||))(?:rthodox|(?:eg|ff)pin|edium(?: ast|)|ast(?: edium|))\]\])/g, '$1-{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/\b(fast)(medium )B(owler)\b/g, '$1–$2b$3'); |
|
|
|
regex(/((?:\]+\|)(?:ight|eft))(rm (?:rthodox|(?:eg|ff)pin|edium(?: ast|)|ast(?: edium|))\]\])/g, '$1-{{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/\b(Fast)(edium owler)\b/g, '$1–{{' + 'subst:' + 'lc:$2}}'); |
|
regex(/\b(ast |edium )B(owler)\b/g, '$1b$2'); |
|
regex(/\b(ast |edium )B(owler)\b/g, '$1b$2'); |
|
regex(/\b(ast|low)(lef|righ)t-rm B(owler)\b/g, '$1 $2-arm b$3'); |
|
regex(/\b(ast|low)((?:lef|righ)t-rm owler)\b/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
regex(/\b(fast)B(owler)\b/g, '$1-b$2'); |
|
regex(/\b(fast)B(owler)\b/g, '$1-b$2'); |
|
regex(/\b(eg|ff)(pin )B(owler)\b/g, '$1-s$2b$3'); |
|
regex(/\b(eg|ff)((?:pin )(?:Bowler|))\b/g, '$1-{{' + 'subst:' + 'lc:$2}}'); |
|
|
|
|
|
regex(/\b(st|nd|rd|th) G(rade)\b/g, '$1 g$2'); |
|
regex(/(== ?\w )(League Table)/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(Contract) +(Detail|Length)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/((?:\||==)\s*Current) +(Club|Line-?up|Roster|Team)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(Points|Pts) +(Ag(?:ain|)st|Diff(?:erence|)|For)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(== ?Top) +(scorers(?: in Order of League Goals|))/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(== ?Touring )P(arty)/g, '$1p$2'); |
|
|
regex(/((?:==|)\s*(?:\d+ Season |Current |Former ))P(layers)/g, '$1p$2'); |
|
|
regex(/(== ?\d+ Gains & )L(osses)/g, '$1l$2'); |
|
|
regex(/(== ?\d+ Signings & )T(ransfers)/g, '$1t$2'); |
|
|
regex(/(== ?\w+) +(Results & Fixtures)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(== ?\w+) +(and Capacity)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(== ?Accidents+)I(ncidents)/g, '$1i$2'); |
|
|
regex(/(Airport) +(Name|Code)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(Bonus )P(oints|ts)/g, '$1p$2'); |
|
|
regex(/(Broadcast )D(ates?)/g, '$1d$2'); |
|
|
regex(/(Busiest) +((?:International |Domestic |) *(?:Flight|Routes(?: Out f|)))/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(City ) ?S(erved)/g, '$1s$2'); |
|
|
regex(/(br(?: ?\/|)>|Aircraft |Passenger |reight )M(ovement)/gi, '$1m$2'); |
|
|
regex(/(br(?: ?\/|)>|Total |Domestic |International )P(assenger)/g, '$1p$2'); |
|
|
regex(/(Date (?:and|&) )T(ime)/gi, '$1t$2'); |
|
|
regex(/(\|\s*(?:Date|Years?)) ((?:f |)\w+)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); //piping added to exclude false positive: "10 Years Younger" |
|
|
regex(/(\|+\s*)Hall \d ?/g, '$1'); //rem over-specific location of match |
|
|
regex(/(Did) +(ot (?:nter|articipate|ualify))/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(: Estimated otes by) +EU P(arty)/gi, '{{' + 'subst:' + 'lc:$1}}EU party'); |
|
|
regex(/(First|Second|Third|1st|2nd|3rd|(?:Four|Fif|Six|Seven|Eigh|Nin|Ten|\d)th) +(Places?(?: Match|))/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(Group )S(tage)/gi, '$1s$2'); |
|
|
regex(/(Seasonal )C(harter)/g, '$1c$2'); |
|
|
regex(/(Term )((?:f |)\w+)/g, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(Top )C(arrier)/g, '$1c$2'); |
|
|
regex(/(Winter |Summer ) ?S(easonal)/g, '$1s$2'); |
|
|
regex(/(Until the )E(nd of)/gi, '$1e$2'); |
|
|
regex(/(Former |Last |New |Previous )C(lub)/gi, '$1c$2'); |
|
|
regex(/(Years |When )S(igned)/gi, '$1s$2'); |
|
|
regex(/(Match )I(nformation)/gi, '$1i$2'); |
|
|
regex(/(\|\s*\w+ )S(taff\b)(?=\s?\w)/gi, '$1s$2'); //bug fix |
|
|
regex(/N(ational Distribution of Seats)/gi, 'N{{' + 'subst:' + 'lc:$1}}'); |
|
|
regex(/(\s?Won (?:Gold|Silver|Bronze) Medal)/gi, '{{' + 'subst:' + 'lc:$1}}'); |
|
|
|
|
|
regex(/(Tour|Test|International) +M(atch)/gi, '$1 m$2'); |
|
|
regex(/(Oppo)(?:sing eam)/g, '$1nent'); |
|
|
regex(/(by )O(pponent)/g, '$1o$2'); |
|
|
regex(/(Tournaments(?:<br>| ))(Met)/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(W–L(?:<br>| ))(Record)/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(Largest(?:<br>| ))(Victory|Defeat)/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
regex(/(Current(?:<br>| ))(Streak)/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
|
|
|
regex(/(Current(?:<br>| ))(Streak)/gi, '$1 {{' + 'subst:' + 'lc:$2}}'); |
|
|
|
|
|
regex(/(MEP<br ?\/>)P(arty)/g, '$1p$2'); |
|
|
regex(/(MEP<br ?\/>\()P(arty\))/g, '$1 p$2'); |
|
|
regex(/(Single Transferable Vote)/g, '{{' + 'subst:' + 'lc:$1}}'); |
|
// regex(/(Official )S(ite)/g, '$1s$2'); |
|
// regex(/(Official )S(ite)/g, '$1s$2'); |
|
// regex(/(+ )O(fficial )W(ebsite\])/g, '$1o$2w$3'); |
|
// regex(/(+ )O(fficial )W(ebsite\])/g, '$1o$2w$3'); |
|
regex(/(\'Further )R(eading)(?=\')/g, '$1r$2'); |
|
regex(/(\'Further )R(eading)(?=\')/g, '$1r$2'); |
|
|
|
|
|
regex(/(\w )A(nd|t) A(n? \w)/g, '$1a$2 a$3'); |
|
regex(/( )A(nd|t) A(n? \w)/g, '$1a$2 a$3'); |
|
regex(/(\w )A(nd|t) (My \w)/g, '$1a$2 $3'); |
|
regex(/( )A(nd|t) M(y \w)/g, '$1a$2 m$3'); |
|
regex(/(\w )A(nd|t) T(he \w)/g, '$1a$2 t$3'); |
|
regex(/( )A(nd|t) T(he \w)/g, '$1a$2 t$3'); |
|
regex(/(\w )By A(n? \w)/g, '$1by a$2'); |
|
regex(/( )By A(n? \w)/g, '$1by a$2'); |
|
regex(/(\w )By (My \w)/g, '$1by $2'); |
|
regex(/( )By m(y \w)/g, '$1by m$2'); |
|
regex(/(\w )By T(he \w)/g, '$1by t$2'); |
|
regex(/( )By T(he \w)/g, '$1by t$2'); |
|
regex(/(\w )For A(n? \w)/g, '$1for a$2'); |
|
regex(/( )For A(n? \w)/g, '$1for a$2'); |
|
regex(/(\w )For (My \w)/g, '$1for $2'); |
|
regex(/( )For M(y \w)/g, '$1for m$2'); |
|
regex(/(\w )For T(he \w)/g, '$1for t$2'); |
|
regex(/( )For T(he \w)/g, '$1for t$2'); |
|
regex(/(\w )In A(n? \w)/g, '$1in a$2'); |
|
regex(/( )In A(n? \w)/g, '$1in a$2'); |
|
regex(/(\w )In (My \w)/g, '$1in $2'); |
|
regex(/( )In M(y \w)/g, '$1in m$2'); |
|
regex(/(\w )In T((?:he|o) \w)/g, '$1in t$2'); |
|
regex(/( )In T((?:he|o) \w)/g, '$1in t$2'); |
|
regex(/(\w )I(nto \w)/g, '$1i$2'); |
|
regex(/( )I(nto \w)/g, '$1i$2'); |
|
regex(/(\w )O(f|n|r) A(n? \w)/g, '$1o$2 a$3'); |
|
regex(/( )O(f|n|r) A(n? \w)/g, '$1o$2 a$3'); |
|
regex(/(\w )O(f|n|r) (My \w)/g, '$1o$2 $3'); |
|
regex(/( )O(f|n|r) M(y \w)/g, '$1o$2 m$3'); |
|
regex(/(\w )O(f|n|r) T(he \w)/g, '$1o$2 t$3'); |
|
regex(/( )O(f|n|r) T(he \w)/g, '$1o$2 t$3'); |
|
regex(/(\w )To A(n? \w)/g, '$1to a$2'); |
|
regex(/( )To A(n? \w)/g, '$1to a$2'); |
|
regex(/(\w )To (My \w)/g, '$1to m$2'); |
|
regex(/( )To M(y \w)/g, '$1to m$2'); |
|
regex(/(\w )To T(he \w)/g, '$1to t$2'); |
|
regex(/( )To T(he \w)/g, '$1to t$2'); |
|
regex(/(\w )With A(n? \w)/g, '$1with a$2'); |
|
regex(/( )With A(n? \w)/g, '$1with a$2'); |
|
regex(/(\w )With M(y \w)/g, '$1with M$2'); |
|
regex(/( )With M(y \w)/g, '$1with M$2'); |
|
regex(/(\w )With T(he \w)/g, '$1with t$2'); |
|
regex(/( )With T(he \w)/g, '$1with t$2'); |
|
|
|
|
|
regex(/(\w )A(t \w)/g, '$1a$2'); |
|
regex(/( )A(t \w)/g, '$1a$2'); |
|
regex(/(\w )I(n \w)/g, '$1i$2'); |
|
regex(/( )I(n \w)/g, '$1i$2'); |
|
regex(/(\w )O( \w)/g, '$1o$2'); //'Or' - false positive (with heraldric Or); 'On' - name (e.g. Ma On Shan) |
|
// regex(/( )O( \w)/g, '$1o$2'); //'Or' - false positive (with heraldric Or); 'On' - name (e.g. Ma On Shan) |
|
|
|
|
|
regex(/(unners?)U(p\b)/g, '$1-u$2'); |
|
regex(/(unners?)U(p\b)/g, '$1-u$2'); |
|
regex(/(unner)(?:ps)\b/g, '$1s-up'); |
|
regex(/(unner)(?:ps)\b/g, '$1s-up'); |
|
regex(/(lay)(ffs?)/g, '$1-o$2'); |
|
regex(/(lay)(ffs?)/g, '$1-o$2'); |
|
|
|
|
regex(/(\W+ )(uarter)F(inal)/g, '$1q$2-f$3'); |
|
|
regex(/(uarter)F(inal)/g, '$1-f$2'); |
|
regex(/(\b\d{4})-P(resent\b)/gi, '$1–p$2'); |
|
regex(/(\W+ )(emi)F(inal)/g, '$1s$2-f$3'); |
|
regex(/(\b\d{4}) - P(resent\b)/gi, '$1 – p$2'); |
|
regex(/(emi)F(inal)/g, '$1-f$2'); |
|
regex(/(\b\d{4}(?:–| – ))P(resent\b)/g, '$1p$2'); |
|
|
|
|
|
regex(/(Bring |Turn )t o(n)/g, '$1It O$2'); //reverting proper name - title of song or work |
|
regex(/(Bring |Turn )t o(n)/g, '$1It O$2'); //reverting proper name - title of song or work |
|
regex(/(Carry )o(n \w*|n film)/g, '$1O$2'); //reverting proper name - 'Carry On' film series |
|
regex(/(Carry )o(n \w*|n film)/g, '$1O$2'); //reverting proper name - 'Carry On' film series |
|
regex(/(Ma )o(n Shan)/g, '$1O$2'); //reverting proper name - 'Ma On Shan' |
|
regex(/(\bMa )o(n Shan\b)/g, '$1O$2'); //reverting proper name - 'Ma On Shan' |
|
regex(/(NZ |New Zealand )o(n Air|n Screen)/g, '$1O$2'); //reverting proper name - 'NZ On Air' |
|
regex(/(NZ |New Zealand )o(n Air|n Screen)/g, '$1O$2'); //reverting proper name - 'NZ On Air' |
|
|
regex(/(\w (?:\[\[|))O(ff-Broadway\b)/g, '$1O$2'); //not a proper noundowncase |
|
regex(/in t(he ir onight)/g, 'In t$1'); //reverting per "In the Air Tonight" |
|
regex(/in t(he ir onight)/g, 'In t$1'); //reverting per "In the Air Tonight" |
|
regex(/in t(he Flesh our)/g, 'In t$1'); //reverting per "In the Flesh tour" |
|
regex(/in t(he Flesh our)/g, 'In t$1'); //reverting per "In the Flesh tour" |
|
regex(/(\W)o(n This Day)/g, '$1O$2'); //reverting per "on This Day" |
|
regex(/(\W)o(n This Day)/g, '$1O$2'); //reverting per "on This Day" |
|
|
regex(/({NYT )o(n this day)/g, '$1O$2'); //reverting per "on This Day" |
|
|
regex(/(\bWing )o(n\s\D)/g, '$1O$2'); //reverting "Wing on" |
|
regex(/(Star Trek )into( Darkness)/g, '$1Into$2'); //reverting proper name - title of work |
|
regex(/(Star Trek )into( Darkness)/g, '$1Into$2'); //reverting proper name - title of work |
|
|
regex(/((?:Sonata|Symphony|Concerto|Prelude)(?: No\. \d\d?|)) in a((?:-flat|) (?:inor|ajor))/g, '$1 in A$2'); //reverting musical term |
|
|
|
|
|
|
} |
|
|
|
|
|
function Ohc_format_MOSFLAG(){ |
|
//remove flagicons from country, birth and death |
|
//remove flagicons from country, birth and death |
|
regex(/((?:birth|death)(?:_?place|)\s*=\s*)\{\{flagu?\|(+)\}\}/gi, '$1$2'); |
|
regex(/((?:birth|death|place|captain|chairman|club|coach|manager|headquarters|citizenship|nationality|occupation|origin|party|region_served|stadium)\s*=\s*)(?:\{\{flag ?icon\|+(?:\|+|)\}\} ?|\]\]\] ?)/gi, '$1'); |
|
regex(/((?:birth|death)(?:_?place|)\s*=\s*)\{\{flag(?:country|icon|)\|(+)\}\}/gi, '$1'); |
|
regex(/((?:birth|death)(?:_?place|)\s*=\s*)\{\{flag(?:country|u|)\|(+)(?:\|+|)\}\}/gi, '$1$2'); |
|
regex(/((?:country(?:_represented)?|nationality|residence)\s*=\s*)\{\{flagu?\|(+)\}\}/gi, '$1$2'); |
|
regex(/((?:(?:birth|death)(?:_?place|)|citizenship|residence|nationality)\s*=\s*)(?:\{\{flag ?icon\|+(?:\|+|)\}\} ?|\]+\]\] ?)/gi, '$1$2'); |
|
regex(/((?:country(?:_represented)?|nationality|residence)\s*=\s*)\{\{flag(?:country|icon|)\|(+)\}\}/gi, '$1'); |
|
regex(/((?:city|location|citizenship|residence|nationality|venue)\s*=\s*)\{\{flag(?:country|)\|(+)(?:\|+|)\}\}/gi, '$1$2'); |
|
|
// regex(/((?:city|location|residence|venue)\s*=\s**)(?:\{\{flag ?icon\|+(?:\|+|)\}\}|\]+\]\]) ?/gi, '$1'); |
|
|
regex(/((?:city|location|citizenship|residence|nationality|venue)\s*=\s*(\]+\|]+\]\]|)*)(?:\{\{flag ?icon\|+(?:\|+|)\}\}|\]+\]\]) ?/gi, '$1'); |
|
|
regex(/((?:country|location|nationality|residence)\s*=\s*)\{\{flagu?\|(+)(?:\|+|)\}\}/gi, '$1$2'); |
|
|
regex(/((?:champs|name|leader|scorer)\s*=\s*)\{\{leagueicon?\|(+)(?:\|+|)\}\}/gi, '$1'); |
|
|
|
|
|
//strip bare facilities icons |
|
|
regex(/\]+)?\]\]\s*/gi, ''); |
|
|
|
|
|
|
|
|
//remove scroll bar for reflists |
|
//remove scroll bar for reflists |
|
regex(/(References ?={1,4})*<div class=*>(*?)<\/div>/gi, '$1$2'); |
|
regex(/(References ?={1,4})*<div class=*>(*?)<\/div>/gi, '$1$2'); |
|
regex(/((?:Notes ?|References ?)={2,4}\s?)*(?:\{\{eflist\}\}|<eferences ?\/>)/gi, '$1{{reflist|colwidth=30em}}'); |
|
// regex(/((?:Notes ?|References ?)={2,4}\s?)*(?:\{\{eflist\}\}|<eferences ?\/>)/gi, '$1{{reflist|colwidth=30em}}'); |
|
|
|
|
|
|
} |
|
|
|
|
|
function Ohc_format_MOSPUNCT(){ |
|
//rem redundant spaces underlining and punctuation |
|
//rem redundant spaces underlining and punctuation |
|
regex(/()(\[?\w+)/gi, '$1\"$2'); |
|
// regex(/()(\[?\w+)/gi, '$1\"$2'); |
|
regex(/(\w+\]?\.?)(\W)/gi, '$1\"$2'); |
|
// regex(/(\w+\]?\.?)(\W)/gi, '$1\"$2'); |
|
regex(/()(\[?\w+)/gi, '$1\'$2'); |
|
regex(/(.)(.)/gi, '$1\"$2'); |
|
regex(/(\w+\]?\.?)(\W)/gi, '$1\'$2'); // replace various single quotes and prime symbol with straight apostrophe |
|
// regex(/()(\[?\w+)/gi, '$1\'$2'); |
|
regex(/(\)>] ) +()/gi, '$1$2'); //rem multiple spaces except when preceded by full stop |
|
regex(/(\w)(s|t)\b/gi, '$1\'$2'); // in-word replacement of various single quotes and prime symbol with straight apostrophe |
|
|
// regex(/(.)(.)/gi, '$1\'$2'); // straight apostrophe (won't touch prime symbol here) |
|
|
// regex(/(\)>] ) +(|)/gi, '$1$2'); //rem multiple spaces except when preceded by full stop; tweaked to not remove dbl spaces where preceded by new sentence (caps) //disabled per User:Mike Christie request 14 August 2023 |
|
regex(/(^\.U\.)+((?:S|K)\.)/gi, '$1$2'); //U. S. and U. K. to U.S. and U.K. |
|
regex(/(^\.U\.)+((?:S|K)\.)/gi, '$1$2'); //U. S. and U. K. to U.S. and U.K. |
|
regex(/(<\/?ref(?: name=*?|)>)*(<ref)/gi, '$1$2'); // remove punctuation between ref tags |
|
regex(/(<\/?ref(?: name=*?|)>)*(<ref)/gi, '$1$2'); // remove punctuation between ref tags |
|
regex(/{1,3}(<\/?ref(?:>| >| n))/gi, '$1'); // remove spaces preceding ref tags and templates |
|
regex(/{1,3}(<\/?ref(?:>| >| n))/gi, '$1'); // remove spaces and line feeds preceding ref tags and templates |
|
regex(/+(\n|\r)/gi, '$1'); //removes multiple spaces preceding line break |
|
// regex(/{1,3}(:\s)/gi, '$1'); // remove spaces preceding colons //disabled following complaint (Peter Coxhead Sept 2017) |
|
|
// regex(/(<\/ref ?>|<ref name=+\/>)()/gi, '$1 $2'); // add spaces after ref tags |
|
|
// regex(/+(\n|\r)/gi, '$1'); //removes multiple spaces preceding line break |
|
regex(/(\d), (\d{3}\b)+/gi, '$1, $2'); //removes nbsp preceding year |
|
regex(/(\d), (\d{3}\b)+/gi, '$1, $2'); //removes nbsp preceding year |
|
regex(/(\d)(?: | )%/gi, '$1%'); //removes nbsp preceding '%' |
|
regex(/(\d)(?: | )%/gi, '$1%'); //removes nbsp preceding '%' |
|
|
regex(/(singer)\/(songwriter)/gi, '$1-$2'); //removes slash |
|
regex(/( )(–|–)/gi, '$1$2'); //Palliative for dashes script insertion of space after nbsp |
|
regex(/( )(–|–)/gi, '$1$2'); //Palliative for dashes script insertion of space after nbsp |
|
|
regex(/(\d{3,4})(?: | )(?:—|–|—)(?: | )(present)/gi, '$1–$2'); //correct dashes spacing per List 40 |
|
|
|
|
|
regex(/\b(US|UK|A(?:US|)|C(?:AN|)|NZ|HK) ()(\d)/g, '$1$2$3'); |
|
regex(/\b(US|UK|A(?:US|)|C(?:AN|)|NZ|HK) ()(\d)/g, '$1$2$3'); |
Line 154: |
Line 353: |
|
//rem linked copyright symbol |
|
//rem linked copyright symbol |
|
regex(/(\\] |©)/gi, ''); |
|
regex(/(\\] |©)/gi, ''); |
|
|
regex(//gi, ''); |
|
|
|
|
|
//rem leading and lagging spaces within wikilinks |
|
//rem leading and lagging spaces within wikilinks |
Line 161: |
Line 361: |
|
regex(/(\\|]*?)+\|*(]+\]\])/gi, '$1|$2'); |
|
regex(/(\\|]*?)+\|*(]+\]\])/gi, '$1|$2'); |
|
// regex(/(\\|]*?)*\|+(]+\]\])/gi, '$1|$2'); //can't remember why we need the second (repeated) line |
|
// regex(/(\\|]*?)*\|+(]+\]\])/gi, '$1|$2'); //can't remember why we need the second (repeated) line |
|
|
|
|
|
regex(/\\(\)\|:]*)( \(\(\)\|]*(?:album|film|magazine|newspaper|song)\))(\]\])/gi, '[[$1$2|$1$3'); //adding piping to album|film|magazine dabbed by parentheticals |
|
|
|
|
|
//symbol for 'times' and dashes |
|
//symbol for 'times' and dashes |
Line 166: |
Line 368: |
|
// regex(/(+)x(+(?:\.+|)\s)/gi, '$1 × $2'); //disabling - never ending false positives |
|
// regex(/(+)x(+(?:\.+|)\s)/gi, '$1 × $2'); //disabling - never ending false positives |
|
regex(/(\d) x (\d )/gi, '$1 × $2'); |
|
regex(/(\d) x (\d )/gi, '$1 × $2'); |
|
regex(/\s(A|B?|C|D|E|F?|G|H|I?|Kr?|L|M|N?|Os?|P?|R|S?|T?|U|V|W|Xe|Yb?|Z)-(?=\1)/g, ' $1–'); //signifying chemical bonds and dash-linking of repeated names |
|
regex(/\s(A|B?|C|D|E|F?|G|H|I?|Kr?|L|M|N?|Os?|P?|R|S?|T?|U|V|W|Xe|Yb?|Z)-(Br|Cl?|F|H|I|N|O|P|Se?)\s/g, ' $1–$2 '); //signifying chemical bonds abbrev |
|
regex(/\s(A|B?|C|D|E|F?|G|H|I?|Kr?|L|M|N?|Os?|P?|R|S?|T?|U|V|W|Xe|Yb?|Z)-(A|B?|C|D|E|F?|G|H|I?|Kr?|L|M|N?|Os?|P?|R|S?|T?|U|V|W|Xe|Yb?|Z)\s/g, ' $1–$2 '); //signifying chemical bonds abbrev |
|
|
// regex(/( *)--( *)/gi, '$1–$2'); //disabling - causes false positives with urls and some images |
|
// regex(/( *)--( *)/gi, '$1–$2'); //disabling - causes false positives with urls and some images |
|
regex(/—/gi, '—'); |
|
// regex(/—/gi, '—'); //stop removing mdash |
|
regex(/() — (?=)/gi, '$1 – '); // tweak to avoid replacing emdashes in strings that are in non-roman unicode characters |
|
regex(/() — (?=)/gi, '$1 – '); // tweak to avoid replacing emdashes in strings that are in non-roman unicode characters |
|
regex(/(\D7\d7)–(\d(?:00|)\D)/gi, '$1-$2'); //airplane model numbers taking hyphen |
|
regex(/(\D7\d7)–(\d(?:00|)\D)/gi, '$1-$2'); //airplane model numbers taking hyphen |
Line 175: |
Line 376: |
|
//inserting a white space between wikilinks to avoid errors upon unlinking |
|
//inserting a white space between wikilinks to avoid errors upon unlinking |
|
regex(/(\]\]?)(\[\[)(?!file|image)/gi, '$1 $2'); |
|
regex(/(\]\]?)(\[\[)(?!file|image)/gi, '$1 $2'); |
|
|
|
|
//hash fixes |
|
|
regex(/( )#(\d{1,3}?\s)/gi, '$1No. $2'); |
|
|
|
|
|
|
//full stop and nbsp fixes |
|
//full stop and nbsp fixes |
Line 184: |
Line 382: |
|
regex(/(\]*)(?:\d?\d\d?\d| \d?\d))(*(?:\.m\.|m)]*?])/gi, '$1♭$2'); |
|
regex(/(\]*)(?:\d?\d\d?\d| \d?\d))(*(?:\.m\.|m)]*?])/gi, '$1♭$2'); |
|
|
|
|
|
//degrees |
|
//degrees and titles |
|
regex(/(Ph)(?:\.\s?|\s)(D)\.?/g, '$1$2'); |
|
regex(/(Ph)(?:\.\s?|\s)(D)\.?/g, '$1$2'); |
|
regex(/(B|M)(?:\.\s?|\s)(Arch|Comm|Ed|Eng|Sc|Tech)\.?(?=\W)/g, '$1$2'); |
|
regex(/\b(B|M)(?:\.\s?|\s)(Arch|Comm|Ed|Eng|Sc|Tech)\.?(?=\W)/g, '$1$2'); |
|
|
// regex(/(\|)\.\s?()\.\s?()\.\s?()\.?\]\]/g, '$1$2$3$4]]'); |
|
|
// regex(/(\|)\.\s?()\.\s?()\.?\]\]/g, '$1$2$3]]'); |
|
|
// regex(/(\|)\.\s?()\.?\]\]/g, '$1$2]]'); |
|
|
|
|
|
//times of day, time ranges |
|
//times of day, time ranges |
Line 197: |
Line 398: |
|
// regex(/(\d?\d\d?\d| \d?\d)(?:*| )(?:a\.m\.|am)(?:*| )(?:*| )(noon|midnight)(?=)/gi, '$1 am – $2'); |
|
// regex(/(\d?\d\d?\d| \d?\d)(?:*| )(?:a\.m\.|am)(?:*| )(?:*| )(noon|midnight)(?=)/gi, '$1 am – $2'); |
|
// regex(/(\d?\d\d?\d| \d?\d)(?:*| )(?:p\.m\.|pm)(?:*| )(?:*| )(noon|midnight)(?=)/gi, '$1 pm – $2'); |
|
// regex(/(\d?\d\d?\d| \d?\d)(?:*| )(?:p\.m\.|pm)(?:*| )(?:*| )(noon|midnight)(?=)/gi, '$1 pm – $2'); |
|
// regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:a\.m\.|am)(?=)/gi, '$1 am'); |
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:am|AM)(?=)/g, '$1 am'); |
|
// regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:p\.m\.|pm)(?=)/gi, '$1 pm'); |
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:pm|PM)(?=)/g, '$1 pm'); |
|
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:\.\.)(?=\S)/g, '$1 am'); |
|
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:\.\.)(?=\S)/g, '$1 pm'); |
|
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:\.)(?=\.)/g, '$1 am'); |
|
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:\.)(?=\.)/g, '$1 pm'); |
|
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:\.)(?=\.<)/g, '$1 am'); |
|
|
regex(/\b(\d?\d\d?\d| \d?\d)(?:*| )(?:\.)(?=\.<)/g, '$1 pm'); |
|
|
|
|
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:kw)\b/gi, '$1 kW'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:kw)\b/gi, '$1 kW'); |
Line 206: |
Line 413: |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:kph|kphr|kmh|kmhr|kmph|kmphr|km\/hr)\b/gi, '$1 km/h'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:kph|kphr|kmh|kmhr|kmph|kmphr|km\/hr)\b/gi, '$1 km/h'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:m\.p\.h\.)\b/gi, '$1 mph'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:m\.p\.h\.)\b/gi, '$1 mph'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(gm|kg|km)s?\b/g, '$1 $2'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(gm|km)s?\b/g, '$1 $2'); |
|
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:g)s?\b/gi, '$1 kg'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*KMs?\b/gi, '$1 km'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*KMs?\b/gi, '$1 km'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*KGs?\b/gi, '$1 kg'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*KGs?\b/gi, '$1 kg'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:K(g|m))s?\b/gi, '$1 k$2'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*(?:K(g|m))s?\b/gi, '$1 k$2'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*cms?/gi, '$1 cm'); |
|
regex(/(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})*cms?/gi, '$1 cm'); |
|
// regex(/(\d{1,3})\s(m|b|tr)illion(\b)/g, '$1 $2illion$3'); |
|
regex(/(\d{1,3})\s(m|b|tr)illion(\b)/g, '$1 $2illion$3'); |
|
|
|
|
|
regex(/(\d)(?: |\s)?C(entimet(?:er|re))/g, '$1 c$2'); |
|
|
regex(/(\d)(?: |\s)?K(ilomet(?:er|re))/g, '$1 k$2'); |
|
|
regex(/(\d)(?: |\s)?KM\b/g, '$1 km'); |
|
|
|
|
|
//turn letter 'x' into symbol '×' |
|
//turn letter 'x' into symbol '×' |
Line 246: |
Line 458: |
|
regex(/(\{convert\|\d+),(\d)/gi, '$1$2'); |
|
regex(/(\{convert\|\d+),(\d)/gi, '$1$2'); |
|
regex(/(\{convert\|\d+),(\d)/gi, '$1$2'); |
|
regex(/(\{convert\|\d+),(\d)/gi, '$1$2'); |
|
|
|
|
|
//inappropriate unit pairs for convert template |
|
|
regex(/(\{\{convert\s*\|\d+(?:\.\d|)\|acre\|)m2(?=)/gi, '$1ha'); |
|
|
|
|
|
//remove leading zeros from convert template |
|
//remove leading zeros from convert template |
|
regex(/(\{\{convert\s*\|)\s*0+(?=)/gi, '$1$2'); |
|
regex(/(\{\{convert\s*\|)\s*0+(?=)/gi, '$1$2'); |
|
|
|
|
|
|
///e-acute accent in spelling |
|
|
regex(/\b(caf|clich)e\b/g, '$1é'); |
|
|
|
|
|
} |
|
|
|
|
|
function Ohc_format_MOSHASH(){ |
|
|
//hash fixes |
|
|
regex(/( )#(\d{1,3}?)/gi, '$1No. $2'); |
|
|
|
|
|
} |
|
|
|
|
|
function Ohc_format_COMMONALITY(){ |
|
///per WP:COMMONALITY |
|
///per WP:COMMONALITY |
|
regex(/()reshman (year)/g, '$1irst $2'); |
|
regex(/()reshman (year)/g, '$1irst $2'); |
|
regex(/()ophomore (album|year)/g, '$1econd $2'); |
|
regex(/()ophomore (album|year)/g, '$1econd $2'); |
|
|
regex(/in order (that )/g, 'so $1'); // see Tony email of 31/8/2019 |
|
|
regex(/in order (to |for )/g, '$1'); // see Tony email of 31/8/2019 |
|
|
regex(/In order t(o )/g, 'T$1'); |
|
|
regex(/In order f(or )/g, 'F$1'); |
|
|
regex(/(said),? in a statement/g, '$1'); |
|
|
regex(/(over|under)\-(u)tili(e?)/g, '$1$2s$3'); //"use" instead of "utilise" |
|
|
regex(/()tili(e?|ing)/g, '$1s$2'); //"use" instead of "utilise" |
|
|
regex(/()tiliation/g, '$1se'); |
|
|
regex(/((?:back|for|down|left|right)ward)s/g, '$1'); |
|
|
regex(/(hil)st/g, '$1e'); |
|
|
regex(/(mong)st/g, '$1'); |
|
|
regex(/(sul)ph(ur|ate)/g, '$1f$2'); //IUPAC spelling per message on Engvar page |
|
|
regex(/c(esium)/g, 'ca$1'); //IUPAC spelling per message on Engvar page |
|
|
regex(/(alumin)(um)/g, '$1i$2'); //IUPAC spelling per message on Engvar page |
|
|
|
|
|
regex(/(New York)(?: City|), New York(?: state|)/g, '$1 City'); |
|
|
|
|
|
//remove Crores and Lakhs in templates converting to USD |
|
//remove Crores and Lakhs in templates converting to USD |
|
regex(/\{\{INR Convert*\|*/gi, '{{INRConvert|'); //removing spaces (redirects to shortcut) |
|
regex(/\{\{INR Convert*\|*/gi, '{{INRConvert|'); //removing spaces (redirects to shortcut) |
|
|
|
|
|
|
|
regex(/(\{INRConvert\|)(-?\d+)0000*\|l(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2|b$3$4'); |
|
regex(/(\{INRConvert\|-?\d{2,})8\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$19$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)0*\|l(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2|m$3$4'); |
|
regex(/(\{INRConvert\|-?\d{2,})7\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$18$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)(\d)*\|l(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2.$3|m$4$5'); |
|
regex(/(\{INRConvert\|-?\d{2,})6\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$17$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)*\|l(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$200000$3$4'); |
|
regex(/(\{INRConvert\|-?\d{2,})5\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$16$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)*\|l(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2$30000$4$5'); |
|
regex(/(\{INRConvert\|-?\d{2,})4\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$15$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)(\d)*\|l(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2$3$4000$5$6'); |
|
regex(/(\{INRConvert\|-?\d{2,})3\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$14$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)(\d)*\|l(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2.$3|m$4$5'); |
|
regex(/(\{INRConvert\|-?\d{2,})2\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$13$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)*\|c(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2$3|m$4$5'); |
|
regex(/(\{INRConvert\|-?\d{2,})1\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$12$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)(\d+)*\|c(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2$3.$4|m$5$6'); |
|
regex(/(\{INRConvert\|-?\d{2,})0\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$11$2'); |
|
regex(/(\{INRConvert\|)(-?\d+)00*\|c(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2|b$3$4'); |
|
regex(/(\{INRConvert\|-?\d{3,})\.\d**(\|c(?:\|-?\d|)\}\})/gi, '$1$2'); |
|
|
|
|
regex(/(\{INRConvert\|)(-?\d+)(\d)0*\|c(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2.$3|b$4$5'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)(\d\d)*\|c(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$2.$3|b$4$5'); |
|
regex(/(\{INRConvert\|)(-?\d+)0000*\|l(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2|b$3$4'); |
|
regex(/(\{INRConvert\|)(-?\d+)*\|c(\|\d|)(?:\|nolink=yes|)(\}\})/gi, '$1$20|m$3$4'); |
|
regex(/(\{INRConvert\|)(-?\d+)0*\|l(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2|m$3$4'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)(\d)*\|l(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2.$3|m$4$5'); |
|
|
|
|
|
regex(/(\{INRConvert\|)(-?\d+)*\|l(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$200000$3$4'); |
|
//Currency notation placements |
|
|
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)*\|l(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2$30000$4$5'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)(\d)*\|l(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2$3$4000$5$6'); |
|
|
// regex(/(\{INRConvert\|)(-?\d+)(\d)*\|l(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2.$3|m$4$5'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)*\|c(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2$3|m$4$5'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)\.(\d)(\d+)*\|c(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2$3.$4|m$5$6'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)00*\|c(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2|b$3$4'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)(\d)0*\|c(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2.$3|b$4$5'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)(\d\d)*\|c(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$2.$3|b$4$5'); |
|
|
regex(/(\{INRConvert\|)(-?\d+)*\|c(\|-?\d|)(?:\|nolink=yes|)((?:\|year=\d{4}|)\}\})/gi, '$1$20|m$3$4'); |
|
|
|
|
|
regex(/(\{INRConvert\|-?\d{2,})8\.\d**(\|(?:\|-?\d|)\}\})/gi, '$19$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})7\.\d**(\|(?:\|-?\d|)\}\})/gi, '$18$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})6\.\d**(\|(?:\|-?\d|)\}\})/gi, '$17$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})5\.\d**(\|(?:\|-?\d|)\}\})/gi, '$16$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})4\.\d**(\|(?:\|-?\d|)\}\})/gi, '$15$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})3\.\d**(\|(?:\|-?\d|)\}\})/gi, '$14$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})2\.\d**(\|(?:\|-?\d|)\}\})/gi, '$13$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})1\.\d**(\|(?:\|-?\d|)\}\})/gi, '$12$2'); |
|
|
regex(/(\{INRConvert\|-?\d{2,})0\.\d**(\|(?:\|-?\d|)\}\})/gi, '$11$2'); |
|
|
regex(/(\{INRConvert\|-?\d{3,})\.\d**(\|(?:\|-?\d|)\}\})/gi, '$1$2'); |
|
|
|
|
|
//Currency notation placements |
|
regex(/\s(\$(?:\d+\.\d\d?|\d{1,3}|\d{1,3},\d{3}))((?:\s| )(?:m|b|tr)illion|)*(?:US(?:|\s?dollars?))\b/gi, ' US$1$2'); |
|
regex(/\s(\$(?:\d+\.\d\d?|\d{1,3}|\d{1,3},\d{3}))((?:\s| )(?:m|b|tr)illion|)*(?:US(?:|\s?dollars?))\b/gi, ' US$1$2'); |
|
|
|
|
Line 286: |
Line 551: |
|
regex(/<!-- Deleted image removed:*? -->\n*/gi, ''); |
|
regex(/<!-- Deleted image removed:*? -->\n*/gi, ''); |
|
|
|
|
|
// setoptions(minor='true'); //removed ",watch='false'" in response to user notification 13 Nov. 2010 |
|
// setoptions(minor='true'); //removed ",watch='false'" in response to user notification 13 Nov. 2010 |
|
// setreason('remove bold formatting', 'append'); |
|
// setreason('remove bold formatting', 'append'); |
|
} |
|
} |
Line 305: |
Line 570: |
|
}; |
|
}; |
|
regex(/(<(?:imagemap)>)(*)(<\/(?:imagemap)>)/gi, protect_function); |
|
regex(/(<(?:imagemap)>)(*)(<\/(?:imagemap)>)/gi, protect_function); |
|
regex(/(\{Wikisource\|)(*)(\})/gi, protect_function); |
|
regex(/(\{(?:Coord|See ?also|Main|Wikisource))(\|*)(\})/gi, protect_function); |
|
|
regex(/(\{\{cit(?:ation|e))(*)(\}\})/gi, protect_function); |
|
regex(/((?:Category|File|Image):)(]*)(])/gi, protect_function); |
|
regex(/((?:Category|File|Image):)(]*)(])/gi, protect_function); |
|
|
regex(/((?:image\d?|image_skyline|imagelocation\d?|imagename|imagefile|img|pic)\s*=)(*)()/gi, protect_function); |
|
|
regex(/(\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|colors?|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)(*)()/gi, protect_function); |
|
|
regex(/(\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|colors?|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)(*)()/gi, protect_function); |
|
regex(/(\|\s*edition\s*=)(]*)(])/gi, protect_function); |
|
regex(/(\|\s*edition\s*=)(]*)(])/gi, protect_function); |
|
regex(/(\|\s*\w*\s*=\s*)(\d(?:st|nd|rd|th)]*)(])/gi, protect_function); |
|
regex(/(\|\s*\w*\s*=\s*)(\d(?:st|nd|rd|th)]*)(])/gi, protect_function); |
|
regex(/(\D)(\d(?:st|nd|rd|th)(?: (?:to |and )(?:the |)\d{1,2}(?:st|nd|rd|th)|) (?:centur|ed|grade|millenni|parallel|round))(.)/gi, protect_function); //protecting lower case terms only; code does not expand where ordinal num is followed by a block cap |
|
regex(/(\D)(\d(?:st|nd|rd|th)(?: (?:to |and )(?:the |)\d{1,2}(?:st|nd|rd|th)|) (?:centur|ed|grade|millenni|parallel|round))(.)/gi, protect_function); //protecting lower case terms only; code does not expand where ordinal num is followed by a block cap |
|
regex(/(\{(?:See ?also|Main))(\|*)(\})/gi, protect_function); |
|
regex(/((?:cover|file(?:name\d?|)|image\d?|image_skyline|imagelocation\d?|imagename|img|pic|map|title|quote)\s*=)(*)()/gi, protect_function); |
|
regex(/((?:cover|file(?:name|)|image\d?|image_skyline|imagelocation\d?|imagename|img|pic|map|title|quote)\s*=)(*)()/gi, protect_function); |
|
|
regex(/(\]*)(\])/gi, protect_function); |
|
regex(/(\]*)(\])/gi, protect_function); |
|
regex(/(\]*)(\|)/gi, protect_function); |
|
regex(/(\]*)(\|)/gi, protect_function); |
|
regex(/(\{\{\w*)(]*)(\}\})/gi, protect_function); |
|
regex(/(\{\{\w*)(]*)(\}\})/gi, protect_function); |
|
regex(/(<ref name=)(*)(>)/gi, protect_function); |
|
regex(/(<ref(?: name="*?" ?|)>)(*?)(<\/ref>)/gi, protect_function); |
|
|
regex(/(<ref(?: name=\w+)>)(*?)(<\/ref>)/gi, protect_function); |
|
regex(/(\{Infobox)( non Test)( cricket)/gi, protect_function); |
|
regex(/(\{Infobox)( non Test)( cricket)/gi, protect_function); |
|
regex(/(.)((?:Chairman's|President'?s) (?:XI|Cup))(.)/g, protect_function); |
|
regex(/(.)((?:Chairman's|President'?s) (?:XI|Cup))(.)/g, protect_function); |
|
regex(/(.)(100\scrore club)(.)/gi, protect_function); |
|
regex(/(.)(100\scrore club)(.)/gi, protect_function); |
|
regex(/(.)(Conference of Presidents)(.)/g, protect_function); |
|
regex(/(.)(Conference of Presidents)(.)/g, protect_function); |
|
|
regex(/(.)((?:Pussy|Infa) Riot)(.)/g, protect_function); |
|
|
regex(/(.)(Dramatical Murder)(.)/gi, protect_function); |
|
|
regex(/(\|]*)(|])/gi, protect_function); |
|
|
|
|
|
regex(/C(hief )E(xecutive )O(fficer\W)/g, 'c$1e$2o$3'); |
|
regex(/(Chief (Executive|Financial|Operating|Information|Marketing) Officer)/g, '{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/C(hief )E(xecutive\W)/g, 'c$1e$2'); |
|
// regex(/C(hief Executive)(?=\W)/g, 'C{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/C(hief )F(inancial )O(fficer\W)/g, 'c$1f$2o$3'); |
|
regex(/M(anaging )D(irector)(?=\W)/g, 'm$1d$2'); |
|
regex(/C(hief )O(perating )O(fficer\W)/g, 'c$1o$2o$3'); |
|
regex(/G(eneral )M(anager\b)(?!of|*=)/g, 'g$1m$2'); |
|
regex(/C(hief )I(nformation )O(fficer\W)/g, 'c$1i$2o$3'); |
|
regex(/(Chairman of the Board(?: of Directors|))/g, '{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/C(hief )M(arketing )O(fficer\W)/g, 'c$1m$2o$3'); |
|
regex(/(oard of Directors)(?=\W)/g, '{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/M(anaging )D(irector\W)/g, 'm$1d$2'); |
|
regex(/(Board Members?)(?=\W)/g, '{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/G(eneral )M(anager\W)(?!of)/g, 'g$1m$2'); |
|
regex(/(Committee Members?)(?=\W)/g, 'c{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/B(oard (?:of |))D(irectors?\W)/g, 'b$1d$2'); |
|
regex(/(Independent (?:(?:Non|)Executive |)Directors)(?=\W)/gi, '{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/B(oard )M(embers?\W)/g, 'b$1m$2'); |
|
regex(/(NonExecutive Directors?)(?=\W)/g, '{{' + 'subst:' + 'lc:$1}}'); |
|
regex(/C(ommittee )M(embers?\W)/g, 'c$1m$2'); |
|
// regex(/I(ndependent )S(chool)(?=\W)/g, 'i$1s$2'); //false positive with Independent Schools Inspectorate etc |
|
regex(/I(ndependent )D(irectors?\W)/g, 'i$1d$2'); |
|
regex(/N(on)P(rofit)(?=\W)/g, 'n$1p$2'); |
|
regex(/I(ndependent )N(on)(xecutive )D(irectors?\W)/g, 'I$1n$2e$3d$4'); |
|
|
regex(/N(on)(xecutive )D(irectors?\W)/g, 'n$1e$2d$3'); |
|
|
regex(/C(hair(?:man|) of the )B(oard\W)/g, 'c$1b$2'); |
|
|
regex(/(\w\s)V(ice)C(hair(?:man|)\W)(?!of)/g, '$1v$2-c$3'); |
|
regex(/(\w\s)V(ice)C(hair(?:man|)\W)(?!of)/g, '$1v$2-c$3'); |
|
regex(/(\w\s)C(hairman\W)(?!of)/g, '$1c$2'); |
|
regex(/(\w\s)C(hairman\W)(?!of)/g, '$1c$2'); |
|
regex(/C(ompany )S(ecretary\W)(?!of)/g, 'c$1s$2'); |
|
regex(/C(ompany )S(ecretary\W)(?!of)/g, 'c$1s$2'); |
|
regex(/G(eneral )S(ecretary\W)(?!of)/g, 'g$1s$2'); |
|
// regex(/G(eneral )S(ecretary\W)(?!of)/g, 'g$1s$2'); //disabled General Secretary |
|
// regex(/(\b\w*\.?\s)V(ice)P(resident\W|rincipal)(?!of)/g, '$1v$2-p$3'); |
|
// regex(/(\b\w*\.?\s)V(ice)P(resident\W|rincipal)(?!of)/g, '$1v$2-p$3'); |
|
regex(/(\w\s+)P(residents)/g, '$1p$2'); |
|
regex(/(\w\s+)P(residents)/g, '$1p$2'); |
Line 347: |
Line 616: |
|
regex(/(\w\s)M(embers of )P(arliament\W)/g, '$1m$2p$3'); |
|
regex(/(\w\s)M(embers of )P(arliament\W)/g, '$1m$2p$3'); |
|
|
|
|
|
|
// Euros - replace space as separator |
|
regex(/(\d)(?: |\s)?C(entimet(?:er|re))/g, '$1 c$2'); |
|
|
regex(/(\d)(?: |\s)?K(ilomet(?:er|re))/g, '$1 k$2'); |
|
regex(/(€|Euros?) ?(\d+)(\d{3})(\d{3})(\d{3})(\d{3})(?=\W)/g, '$1$2,$3,$4,$5,$6'); |
|
regex(/(\d)(?: |\s)?KM\b/g, '$1 km'); |
|
regex(/(€|Euros?) ?(\d+)(\d{3})(\d{3})(\d{3})(?=\W)/g, '$1$2,$3,$4,$5'); |
|
|
regex(/(€|Euros?) ?(\d+)(\d{3})(\d{3})(?=\W)/g, '$1$2,$3,$4'); |
|
|
regex(/(€|Euros?) ?(\d{3})(\d{3})(?=\W)/g, '$1$2,$3'); |
|
|
regex(/(\d+)(\d{3})(\d{3}) ?(€|Euros?|\\])(?=\W)/g, '$4$1,$2,$3'); |
|
|
regex(/(\d+)(\d{3}) ?(€|Euros?|\\])(?=\W)/g, '$3$1,$2'); |
|
|
|
|
|
// replace space as separator |
|
// replace full stop as thousands separator |
|
regex(/(\W)(\d+) (\d{3}) (\d{3}) (\d{3}) (\d{3})(?=\W)/g, '$1$2,$3,$4,$5,$6'); |
|
regex(/(\|+)(\d+)(\d{3})(\d{3})(\d{3})(?=*)/g, '$1$2,$3,$4,$5'); |
|
regex(/(\W)(\d+) (\d{3}) (\d{3}) (\d{3})(?=\W)/g, '$1$2,$3,$4,$5'); |
|
regex(/(\|+)(\d+)(\d{3})(\d{3})(?=*)/g, '$1$2,$3,$4'); |
|
regex(/(\W)(\d+) (\d{3}) (\d{3})(?=\W)/g, '$1$2,$3,$4'); |
|
// regex(/(\|+)(\d+)(\d{3})(?=*)/g, '$1$2,$3'); //disabled 2 april 2017 due to false positives with 3dp |
|
regex(/(\W)(\d{3}) (\d{3})(?=\W)/g, '$1$2,$3'); |
|
|
|
|
|
|
// replace comma as decimal separator, or full stop as thousands separator |
|
// replace comma as decimal separator |
|
regex(/()*(\d+).(\d\d\d).(\d\d\d)(?=\W)/g, '$1$2,$3,$4'); |
|
regex(/(\|+)(\d+),(\d\d?)(?=*)/g, '$1$2.$3'); //add obligatory space or single quote mark,- false positives within convert templates |
|
|
regex(/(\(\d+),(\d\d?%\))/g, '$1.$2'); //percentages in parentheses |
|
|
regex(/(\{\{(?:de|in)crease\}\}\s*)(\d+),(\d\d?)(?=*)/g, '$1$2.$3'); |
|
|
|
|
|
regex(/()*(\d+)(?=\W)/g, '$1$2'); |
|
regex(/()(\d+),(\d\d?)(?=\W)/g, '$1$2.$3'); |
|
regex(/()(\d+),(\d\d?)(?=\W)/g, '$1$2.$3'); |
|
regex(/(\W)(\d+),(\d\d?)*(?=%)/g, '$1$2.$3'); |
|
regex(/(\W)(\d+),(\d\d?)*(?=|Euro?)/g, '$1$2.$3'); |
|
|
regex(/(\|\s*attendance\s*=\s*\d{1,3})?(\d{3}\D)/gi, '$1,$2'); |
|
|
|
|
|
// layout - rem horizontal lines per WP:LAYOUT |
|
|
// regex(/(\n)----\n/g, '$1'); // html element - may sometimes be appropriate – disabled per discussion at WT:LAYOUT July 2014 |
|
|
|
|
|
//remove Crores and Lakhs not in templates |
|
//remove Crores and Lakhs not in templates |
|
regex(/(\d+)?(?:lakh|\\])(?:crores?|\\])/g, '$1 trillion (])'); |
|
regex(/(\d+)?(?:lakh|\\])(?:crores?|\\])/g, '$1 trillion (])'); |
|
|
|
|
|
regex(/(?:(\d+),|)(\d+)0,000(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs|)\]\])(?=)/g, '$1$2 billion'); |
|
regex(/(?:(\d+),|)(\d+)0,000(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs?|)\]\]s?)(?=)/g, '$1$2 billion'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs|)\]\])(?=)/g, '$1$2$30,000'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs?|)\]\]s?)(?=)/g, '$1$2$30,000'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(\d)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs|)\]\])(?=)/g, '$1$2$3$4,000'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(\d)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs?|)\]\]s?)(?=)/g, '$1$2$3$4,000'); |
|
regex(/(?:(\d+),|)(\d+)0(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs|)\]\])(?=)/g, '$1$2 million'); |
|
regex(/(?:(\d+),|)(\d+)0(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs?|)\]\]s?)(?=)/g, '$1$2 million'); |
|
regex(/(?:(\d+),|)(\d+)(\d+)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs|)\]\])(?=)/g, '$1$2.$3 million'); |
|
regex(/(?:(\d+),|)(\d+)(\d+)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs?|)\]\]s?)(?=)/g, '$1$2.$3 million'); |
|
regex(/(?:(\d+),|)(\d+)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs|)\]\])(?=)/g, '$1$200,000'); |
|
regex(/(?:(\d+),|)(\d+)(?: |\s)?(?:acs?|akhs?|\akhs?(?:\||\|acs?|\|akhs?|)\]\]s?)(?=)/g, '$1$200,000'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs|\|rores|)\]\])(?=)/g, '$1$2$3 million'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs?|\|rores?|)\]\]s?)(?=)/g, '$1$2$3 million'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(\d+)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs|\|rores|)\]\])(?=)/g, '$1$2$3.$4 million'); |
|
regex(/(?:(\d+),|)(\d+)\.(\d)(\d+)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs?|\|rores?|)\]\]s?)(?=)/g, '$1$2$3.$4 million'); |
|
regex(/(?:(\d+),|)(\d+)00(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs|\|rores|)\]\])(?=)/g, '$1$2 billion'); |
|
regex(/(?:(\d+),|)(\d+)00(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs?|\|rores?|)\]\]s?)(?=)/g, '$1$2 billion'); |
|
regex(/(?:(\d+),|)(\d+)(\d\d)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs|\|rores|)\]\])(?=)/g, '$1$2.$3 billion'); |
|
regex(/(?:(\d+),|)(\d+)(\d\d)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs?|\|rores?|)\]\]s?)(?=)/g, '$1$2.$3 billion'); |
|
regex(/(?:(\d+),|)(\d+)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs|\|rores|)\]\])(?=)/g, '$1$20 million'); |
|
regex(/(?:(\d+),|)(\d+)(?: |\s)?(?:rs?|rores?|\rores?(?:\|rs?|\|rores?|)\]\]s?)(?=)/g, '$1$20 million'); |
|
|
|
|
|
// Indian commas |
|
// Indian commas |
Line 404: |
Line 684: |
|
} |
|
} |
|
|
|
|
|
|
/** ------------------------------------------------------------------------ **/ |
|
function make_dates_bold(){ |
|
|
|
/// LINKSPAM removal with protection for Reference tags and External links |
|
//********************************************************************************************** |
|
|
|
|
|
// This script was originally written by Lightmouse to make dates bold - for timelines, etc. |
|
|
|
var linkmap=; |
|
// For use mainly with timelines, it makes dates after bullet points into bold type |
|
|
|
function ohc_linkspam() |
|
|
{ |
|
|
// protects everything within reference tags |
|
|
// the sensitive part is stored and replaced with a unique identifier, |
|
|
// which is later replaced with the stored part. |
|
|
|
|
|
|
var protect_function = function(s, begin, replace, end) { |
|
var txt=document.editform.wpTextbox1; |
|
|
|
linkmap.push(replace); |
|
|
return begin + "⍌"+(linkmap.length-1)+"⍍" + end; |
|
|
}; |
|
|
|
|
|
|
regex(/(== ?(?:Bibliography|Further reading|References|Sources|Works) ?==+)(\n*?)(\n)(?===)/gi, protect_function); |
|
//process date ranges containing a hyphen '* month dd - month dd:' |
|
|
|
regex(/(== ?(?:Attribution|External links) ?==+)(\n*?)(\]+\]\])/gi, protect_function); |
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?\s?\s?(?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?)\s?:\s?/gi, '* \'\'\'$1:\'\'\' '); |
|
|
|
regex(/({{(?:r?efn|sfnp?|wikicite) ?\|)(*?)(}})/gi, protect_function); |
|
|
regex(/(<ref name="*?" ?>)(*?)(<\/ref>)/gi, protect_function); |
|
|
regex(/(<ref*?>)(*?)(<\/ref>)/gi, protect_function); |
|
|
regex(/(\|\s?(?:image|model|references?|video)\d\s?=\s??\]*)(\])/gi, protect_function); |
|
|
regex(/(?\]*)(\])/gi, protect_function); //protect links within tables |
|
|
|
|
|
//process date ranges containing a hyphen '* month dd dd:' |
|
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?\s?\s?\d\d?)\s?:\s?/gi, '* \'\'\'$1:\'\'\' '); |
|
|
|
|
|
|
|
|
|
//protect date ranges containing a hyphen |
|
|
|
regex(/(?)\]*+(]*)\](?!*+)/gi, '$1$2'); |
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?\s?)(\s?(?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?)\s?:\s?/gi, '$1xx$2'); |
|
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?\s?)(\s?\d\d?)\s?:\s?/gi, '$1xx$2'); |
|
|
|
|
|
//process dates containing a hyphen |
|
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?\s?)\s?/gi, '* \'\'\'$1:\'\'\' '); |
|
|
|
|
|
|
//unprotect date ranges containing a hyphen |
|
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?\s?)xx(\s?(?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?)\s?:\s?/gi, '$1–$2'); |
|
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December) \d\d?\s?)xx(\s?\d\d?)\s?:\s?/gi, '$1–$2'); |
|
|
|
|
|
|
//process other dates |
|
|
regex(/\*\s?((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d\d?(?:,\s?\d{1,4})?\s?)\s/gi, '* \'\'\'$1\'\'\' '); |
|
|
regex(/\*\s?(\d\d?\s(?:January|February|March|April|May|June|July|August|September|October|November|December)(?:\s\d{1,4})?\s?)\s/gi, '* \'\'\'$1\'\'\' '); |
|
|
|
|
|
|
|
//removes protection put in place by function ohc_protect_fmt (all cats, templates etc.) |
|
// edit_summary(); |
|
|
|
regex(/⍌(+)⍍/g, function(x, n) { |
|
|
var res = linkmap; |
|
|
res = res.replace(/⍌(+)⍍/g, function(x, n) { |
|
|
var res = linkmap; |
|
|
res = res.replace(/⍌(+)⍍/g, function(x, n) { |
|
|
var res = linkmap; |
|
|
res = res.replace(/⍌(+)⍍/g, function(x, n) { |
|
|
return linkmap; |
|
|
}); |
|
|
return res; |
|
|
}); |
|
|
return res; |
|
|
}); |
|
|
return res; |
|
|
}); |
|
} |
|
} |
|
|
|
|
Line 440: |
Line 736: |
|
// regex(/\mage):/g, '[[File:'); |
|
// regex(/\mage):/g, '[[File:'); |
|
//add {{url}} template to infobox parameter |
|
//add {{url}} template to infobox parameter |
|
regex(/((?:homepage)*=)*(http:\/\/]+)(?=)/gi, '$1{{url|$2}}'); |
|
regex(/(\{\{) ?(url) ?(?=\|)/gi, '$1$2'); |
|
|
regex(/(\{\{url\|)*(?:http:\/\/|)(www\.+\}\})*(?=)/gi, '$1$2'); |
|
|
regex(/(\{\{url\|)(?:http:\/\/|)www\.(+)\|(?:\2|Official (?:web|)site)}}(?=)/gi, '$1$2}}'); |
|
|
regex(/(\| ?homepage*=)*(?:http:\/\/|)(]+)(?=)/gi, '$1\{\{url|$2\}\}'); //rem 'website=' |
|
|
regex(/(\| ?(?:homepage|website)*=)*\]+) \2\3\](?=)/gi, '$1\{\{url|$3}}'); |
|
|
regex(/(\| ?(?:homepage|website)*=)*\]+) official (?:web|)site\](?=)/gi, '$1{{url|$2}}'); |
|
|
|
|
|
|
//remove icons from headers (needs to occur before protection) |
|
} |
|
|
|
regex(/(==?(?:*))\]+?\]\](*)(?==)/gi, '$1$2$3'); |
|
|
|
|
function Ohc_football_retrain(){ |
|
|
//update file names that are supposed to include dashes instead of hyphens |
|
|
regex(/(\\d{2} (?:\. |))Fußball-((?:Bundesl|L)iga)/gi, '$1$2'); |
|
|
regex(/(\(\d{2} in *football\|)/gi, '$1–$2'); |
|
|
regex(/(\(\d{2} * season\|)/gi, '$1–$2'); |
|
|
regex(/(\(\d{2} (?:Asian Club Championship|AFC Champions League|(?:(?:2\. |)Bundesl|3\. L)iga|Ekstraklasa|Eredivisie|Serie \d?|UEFA (?:Cup Winners' |)Cup|UEFA (?:Champions|Europa) League|Danish (?:Superliga|(?:st|nd|rd) Division)|French football Division \d|Czechoslovak First League|Gambrinus liga|Czech Cup|Coppa Italia|* (?:Premier|Super) League|KNVB Cup|Liga (?:Arzit|Leumit))\|)/gi, '$1–$2'); |
|
|
//plus retraining |
|
|
regex(/(\\d?|UEFA (?:Cup Winners' |)Cup|UEFA (?:Champions|Europa) League|Danish (?:Superliga|(?:st|nd|rd) Division)|French football Division \d|Czechoslovak First League|Gambrinus liga|Czech Cup|Coppa Italia|* (?:Premier|Super) League|KNVB Cup|Liga (?:Arzit|Leumit)) (\d{4})(\d{2})(#|\|)/gi, '$1$3–$4 $2$5'); |
|
|
|
|
|
|
regex(/(\{\{Fb cl\d?*\|s=*(?:19|20)\d\d)(\d\d*\|)/gi, '$1-$2'); //undo dashes.js change for non-recognising template |
|
|
|
|
|
|
} |
|
} |
Line 459: |
Line 751: |
|
function Ohc_final_cleanup(){ |
|
function Ohc_final_cleanup(){ |
|
|
|
|
|
//remove redundant piping |
|
//adjust piping - remove redundant, adding piping for parentheticals |
|
|
regex(/\\|]*)\|(a)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(b)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(c)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(d)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(e)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(f)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(g)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(h)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(i)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(j)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(k)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(l)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(m)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(n)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(o)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(p)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(q)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(r)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(s)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(t)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(w)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(x)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(y)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
|
regex(/\\|]*)\|(z)\1( ]*|)(\]\])/g, '[[$2$1$4$3'); |
|
regex(/\\|]*)\|\1( ]*|)(\]\])/gi, '[[$1$3$2'); |
|
regex(/\\|]*)\|\1( ]*|)(\]\])/gi, '[[$1$3$2'); |
|
|
regex(/\\(\)\|:]*)( \((?:\d{4} |)film\))(\]\])/gi, '\'\'[[$1$2|$1$3\'\''); |
|
|
regex(/\\(\)\|:]*)( \(\(\)\|]*(?:album|film|magazine|newspaper|song|\bEP)\))(\]\])/g, '[[$1$2|$1$3'); //adding piping to album|film|magazine dabbed by parentheticals |
|
|
// regex(/(\\(\)\|:]*)( \(\(\)\|]*\))(\]\])(?!)/gi, '$1$2$3|$2$4'); //ensure songs titles not piped by default, but disabled due to false removal from visible disambiguators |
|
|
|
|
|
// deprecated parameters in citation templates |
|
|
regex(/(\|\s*)coauthors(\s*=\s*)/g, '$1author2$2'); |
|
|
|
|
|
} |
|
} |
|
|
|
|
|
function Ohc_eject_zh(){ |
|
|
//Chinese language template - eject language clutter from lead |
|
|
|
|
|
|
|
function Ohc_downcase_headings(){ |
|
regex(/(\|2?=)\{\{linktext(?:\|())(?:\|())(?:\|())(?:\|()|)(?:\|()|)\}\}/g, '$1$2$3$4$5$6'); |
|
|
|
//cleanup of headings per MOSHEAD before complete downcasing (most code is copied from other parts of the script) |
|
regex(/(,? )\(\{\{zh(\|+)\}\}(?: )/gi, '$1{{Chinese$2}}('); |
|
|
|
// remove file |
|
regex(/(,? )\(\{\{zh(\|+)\}\}(?: | ?)/gi, '$1{{Chinese$2}}('); |
|
|
regex(/\(\)/g, ' '); |
|
regex(/(==?(?:*))\]+?\]\](*)(?==)/gi, '$1$2$3'); |
|
|
|
|
regex(/\(\) /g, ' '); |
|
|
|
//rem linking within section headings |
|
|
regex(/(==?(?:*))\]+?)\]\]((?:*|)?==)/gi, '$1$2$3'); |
|
|
regex(/(==?(?:*))\]+?\|(]+?)\]\]((?:*|)?==)/gi, '$1$2$3'); |
|
|
regex(/(==?(?:*))\]+?\||)(]+?)\]\](*)\]+?\||)(]+?)\]\](?:(*)\]+?\||)(]+?)\]\]|)((?:*|)?==)/gi, '$1$2$3$4$5$6$7'); |
|
|
|
|
|
//original code |
|
|
regex(/(==+?)(*)(?===+ ?\n)/g, '$1{{' + 'subst:' + 'lc:$2}}'); |
|
|
|
|
|
} |
|
} |
|
|
|
|
|
function Ohc_castlist(){ |
|
|
//remove flagicons from country, birth and death |
|
|
regex(/(\* )(\*\]\]) as (*)()(*)()/gi, '$1\'\'\'$3\'\'\' ($2)$4$5$6'); |
|
|
|
|
|
|
} |
|
|
|
|
/** ------------------------------------------------------------------------ **/ |
|
/** ------------------------------------------------------------------------ **/ |
|
/// PROTECTION BY STRING SUBSTITUTION |
|
/// PROTECTION BY STRING SUBSTITUTION |
Line 493: |
Line 826: |
|
regex(/((?:{2,3}):)(]*)(])/gi, protect_function); |
|
regex(/((?:{2,3}):)(]*)(])/gi, protect_function); |
|
regex(/(\{(?:See ?also|Main))(\|*)(\})/gi, protect_function); |
|
regex(/(\{(?:See ?also|Main))(\|*)(\})/gi, protect_function); |
|
regex(/((?:cover|file(?:name|)|image\d?|image_skyline|imagelocation\d?|imagename|img|pic|map)\s*=)(*)()/gi, protect_function); |
|
regex(/((?:cover|file(?:name|)|image\d?|image_skyline|imagelocation\d?|imagename|img|pic|map|quote|title)\s*=)(*)()/gi, protect_function); |
|
regex(/(\]*)(\|)/gi, protect_function); |
|
regex(/(\]*)(\|)/gi, protect_function); |
|
regex(/(\{\{\w*)(]*)(\}\})/gi, protect_function); |
|
regex(/(\{\{\w*)(]*)(\}\})/gi, protect_function); |
|
regex(/(<ref name=)(*)(>)/gi, protect_function); |
|
regex(/()(*)()/gi, protect_function); |
|
|
regex(/(<ref name=)(*)(>)/gi, protect_function); |
|
|
regex(/(Convoy(?: |\s))(\w{2,3}(?: |\s)\d\d(?: |\s)?\w{2,3})(.)/gi, protect_function); |
|
regex(/(\{Infobox)( non Test)( cricket)/gi, protect_function); |
|
regex(/(\{Infobox)( non Test)( cricket)/gi, protect_function); |
|
|
regex(/(\d*)(Cr App R)(.)/g, protect_function); |
|
|
regex(/(.)(British Coal Utilisation Research Association)(.)/g, protect_function); |
|
regex(/(.)(On a Friday)(.)/g, protect_function); |
|
regex(/(.)(On a Friday)(.)/g, protect_function); |
|
|
regex(/(.)(Not On Our Watch Project)(.)/g, protect_function); |
|
regex(/(.)(Octopussy and the living daylights)(.)/gi, protect_function); |
|
regex(/(.)(Octopussy and the living daylights)(.)/gi, protect_function); |
|
regex(/(.)(\'?Carry On *)(.)/g, protect_function); |
|
regex(/(.)(\'?Carry On *)(.)/g, protect_function); |
|
regex(/(.)(10 metre (?:air|running) \w*)(.)/g, protect_function); |
|
regex(/(.)(10 metre (?:air|running) \w*)(.)/g, protect_function); |
|
|
regex(/(.)(\d day (?:schools) \w*)(.)/g, protect_function); |
|
|
regex(/(.)(TV)(.)/g, protect_function); |
|
|
|
|
|
|
regex(/(\|\s*quote\s*=)(+)(\|)/g, protect_function); |
|
|
|
|
} |
|
} |
|
|
|
|
Line 527: |
Line 869: |
|
|
|
|
|
/** ------------------------------------------------------------------------ **/ |
|
/** ------------------------------------------------------------------------ **/ |
|
|
|
|
|
//DRIVERS |
|
|
function Ohc_formats(){ |
|
|
|
|
|
Ohc_format_Sundry(); |
|
|
Ohc_format_MOSCAPS(); |
|
|
Ohc_format_MOSFLAG(); |
|
|
Ohc_format_MOSPUNCT(); |
|
|
Ohc_format_MOSHASH(); |
|
|
Ohc_format_COMMONALITY(); |
|
|
} |
|
|
|
|
|
function Ohc_formatsbis(){ |
|
|
|
|
|
Ohc_format_Sundry(); |
|
|
Ohc_format_MOSCAPS(); |
|
|
Ohc_format_MOSFLAG(); |
|
|
Ohc_format_MOSPUNCT(); |
|
|
// Ohc_format_MOSHASH(); |
|
|
Ohc_format_COMMONALITY(); |
|
|
} |
|
|
// </syntaxhighlight> |