Content deleted Content added
Ohconfucius (talk | contribs) protect Canadian federal by-election template |
Ohconfucius (talk | contribs) partial alignment to test script |
||
Line 121:
ohc_regex(/\[\[@DD@th?(?:\s|_| )@Month\]\]/gi, "@Day @LMonth");
ohc_regex(/\[\[@Month(?:\s|_| )@DD@th?\]\]@th?/gi, "@LMonth @Day"); //consolidated regex with flexible removal of ordinal simple date
ohc_regex(/\[\[@Day @Month\]\]/gi, "@Day @
ohc_regex(/\[\[@Month @YYYY\]\]/gi, "@
ohc_regex(/\[\[@YYYY\]\]/gi, "@YYYY");
Line 134:
// remove nowrap template from dm and md dates
ohc_regex(/(date[ ]*=[ ]*)\{\{(?:j|no ?(?:break|wrap))\|(?:@DD(?:[ _]| )@Month)( @yyyy|)\}\}/gi, '$1@DD @
ohc_regex(/(date[ ]*=[ ]*)\{\{(?:j|no ?(?:break|wrap))\|(?:@Month(?:[ _]| )@DD)( @yyyy|)\}\}/gi, '$1@
//delink yyyy-mm-dd dates
Line 150:
//delink single dm or 'dth the m'
ohc_regex(/(?:the\s)?\[\[@Day@th?[\s_](?:of[\s_])?@Month\]\]/gi, "@Day @LMonth");
//delink single md or 'm the dth'
ohc_regex(/\[\[@Month[\s_](?:the[\s_])?@Day@th?\]\](?=\W)/gi, "@LMonth @Day");
//Month+day_number "[[March 7]]th" -> "March 7"
Line 176:
regex(/\[\[(?:first|second|third|(?:four|fif|six|seven|eigh|nin|ten|eleven|twelf|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twentie)th|twenty[\s\-]first)[\s\-_]centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE))?\|([^\]]{1,30})\]\]/gi, '$1');
regex(/\[\[(\d{1,2}(?:st|[nr]d|th)[\s\-_])(centur(?:y|ies))(\s(?:AD|BC|CE|BCE)|)\]\]/gi, '$1$2$3');
// months
ohc_regex(/\[\[@Month\]\]/gi, "@
ohc_regex(/\[\[@FullMonth\|([^\]]{1,30})\]\]/gi, "$1");
Line 196:
//month+year
//Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below
ohc_regex(/\[\[@yyyy in[^|\]]+\|@Day @Month @YYYY\]\]/gi, "@Day @
ohc_regex(/\[\[@yyyy in[^|\]]+\|@Month @Day,? @YYYY\]\]/gi, "@
ohc_regex(/\[\[@yyyy#[^|\]]+\|(@month\s|)(@yyyy)\]\]/gi, "$1$2");
ohc_regex(/\[\[@yyyy#[^|\]]+\|(@month|@yyyy)\]\]/gi, "$1");
Line 214:
//Identify surprise or 'Easter egg' diversions linking months to year or "year in" articles.
ohc_regex(/\[\[\d{1,4}#[^|\]]+\|@Month\]\]/gi, "@LMonth");
ohc_regex(/
// month and day piped
ohc_regex(/
ohc_regex(/\[\[@month[\s_]@day\|([^\]]{1,30})\]\]/gi, "$1");
ohc_regex(/\[\[@day(?:\s|_|@th )(?:of[\s_]|)?@month\|([^\]]{1,30})\]\]/gi, "$1");
Line 261 ⟶ 260:
// remove parasitic metadata - days of the week/descriptives
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:[^|}\d]*|)@Day\s+@Month\s+@YYYY((?:[a-z]\b|)\s?)[^|<}]*(?=[\s\n]*[<|}])/gi, "$1@Day @Month @YYYY$2"); //rem negate "<", "hyphens" "dashes" 26/6/2020
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)[^|}]*@Month\s+@Day,\s+@YYYY((?:[a-z]\b|)\s?)[^|<}]*(?=[\s\n]*[<|}])/gi, "$1@Month @Day, @YYYY$2"); //rem negate "<", "hyphens" "dashes" 26/6/2020
// ohc_regex(/(\|\s*date\s*=\s*)(?:[^|}–<]*\D|)@Day\s+@Month\s+@YYYY ?– ?@Day\s+@Month\s+@YYYY[^|}–<]*(?=[\s\n]*[<|}])/gi, "$1@Day1 @Mon1 @Year1 – @Day2 @Mon2 @Year2");
// ohc_regex(/(\|\s*date\s*=\s*)[^|}–<]*@Month\s+@Day,\s+@YYYY ?– ?@Month @Day, @YYYY[^|}–<]*(?=[\s\n]*[<|}])/gi, "$1@Mon1 @Day1, @Year1 – @@Mon2 Day2, @Year2");
Line 341 ⟶ 340:
//zap redundant {{date}}, {{accessdate}} {{retrieved}}, {{monthname}} and {{#dateformat}}
// regex(/({{(?:end|start)[-–]date)\|df=y(?:es|)/gi, "$1"); //rem deprecated parameter - disabled: doesn't work here, so ejected to the formatting script
ohc_regex(/{{#formatdate:@YYYY-@MM-@DD(?:[^\}]*)}}/gi, "@Day @Month @YYYY");
regex(/{{#formatdate:([^}]+)}}/gi, "$1");
regex(/\{\{#dateformat:([^}\|]+)(?:\|dmy|\|mdy)?\}\}/gi, '$1');
Line 373:
regex(/(\(20)([01])(7)[-–]([8-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(8)[-–](9\))/gi, '$1$2$3–$2$4');
ohc_regex(/(\W)@DD@th?, @DD@th?((?:[ ]| )(?:and|&|to|or)(?:[ ]| ))@DD@th?(?:\sof\s?)?([ ]| )@Month(?=\W)/gi, '$1@Day1, @Day2$2@Day3$3@LMonth');
Line 496 ⟶ 490:
ohc_regex(/(\D\W)@Month(\s| )@DD@th?(?:(?:\s*| |)[-–](?:\s*| |))@DD@th?(?=\W\D)/gi, "$1@LMonth1$2@Day1–@Day2");
ohc_regex(/(\D\W)@DD@th?(?:(?:\s*| |)[-–](?:\s*| |))@DD@th?(\s| )@Month(?=\W\D)/gi, "$1@Day1–@Day2$2@LMonth1");
// spaces and commas between month and year (again)
Line 694 ⟶ 678:
//add comma where missing
ohc_regex(/(\D\W)@Month\s@Day,?\s@YYYY,?(?=\s
//rem superfluous comma where applicable
ohc_regex(/(\D[^\w\/])@Month\s@ZD,,(?=\W\D|\b)/gi, "$1@LMonth @Day,");
Line 728 ⟶ 712:
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month,?( (?:19|20)\d\d) ?(?:-|–|–) ?@Month,? @YYYY(?=\s*[|}])/gi, "$1@FullMonth1$2 – @FullMonth2 @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)((?:19|20)\d\d) ?(?:-|–|–) ?@Month @YYYY(?=\s*[|}])/gi, "$1@$2 – @FullMonth @YYYY");
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))((?:[01-2]?\d|30|31) |)@Month @YYYY ?(?:-|–|–) ?((?:[01-3]?\d|30|31) |)@Month @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2@FullMonth1 @YYYY1 – $3@FullMonth2 @YYYY2");
Line 908 ⟶ 888:
regex(/([\s\S])(23rd March 1931: Shaheed)([\s\S])/gi, protect_function);
regex(/([\s\S])(Long March [1-7])([\s\S])/gi, protect_function);
regex(/([\s\S])(National September 11 Memorial & Museum)([\s\S])/gi, protect_function);
regex(/([\s\S])(Queen Elizabeth II September 11th Garden)([\s\S])/gi, protect_function);
regex(/([\s\S])(Bombay March 12)([\s\S])/gi, protect_function);
regex(/([\s\S])(movement 2 June)([\s\S])/gi, protect_function);
Line 914 ⟶ 896:
regex(/([\s\S])(4th\sof August regime)([\s\S])/gi, protect_function);
regex(/([\s\S])(19th\sof April movement)([\s\S])/gi, protect_function);
regex(/([\s\S])(June 4th (?:incident|museum))([\s\S])/gi, protect_function);
regex(/([\s\S])(The Battle Of Marston Moor \(July 2nd,? 1644\))([\s\S])/gi, protect_function);
regex(/([\s\S])(Night of January 16th)([\s\S])/gi, protect_function);
Line 949 ⟶ 931:
ohc_regex(/(Bootmoon Series: [\w ]*[-–] @fullmonth)( @day, @YYYY)(.)/gi, protect_function);
// expressions and grammatical strings including modal "may"
regex(/(\W)((?:\d{1,3}) may)((?: have(?: \w+|)|) be)/g, protect_function);
regex(/(\W)((?:\d{3}|3[2-9]|[4-9]\d)\/\d dec(?:l\.?|))(\W)/gi, protect_function);
regex(/(\W)((?:\d{2,3})\/\d dec(?:l\.?|))( \(\d\d? overs)/gi, protect_function);
Line 1,186 ⟶ 1,170:
/** ------------------------------------------------------------------------ **/
function ohc_body_dates_to_dmy()
{
Line 1,212 ⟶ 1,194:
/** ------------------------------------------------------------------------ **/
function ohc_all_to_dmy_driver(e)
{
Line 1,323 ⟶ 1,303:
ohc_delink_year_in_X();
}
function ohc_expand_ref_dates_driver(e) {
|