Content deleted Content added
Ohconfucius (talk | contribs) partial alignment to test script |
Ohconfucius (talk | contribs) align function ohc_delink_dates |
||
Line 105:
{
//add missing space between wikilinks
regex(/(\]\])(\[\[
// rem redundant quote marks and parentheses
Line 113:
regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\(([^|}\[\]]*)\)(?=\s*[|}])/gi, "$1$2");
ohc_regex(/\[\[@Month (?:the\s)?@Day(?:\]\],? \[\[|, )@YYYY\]\]/gi, "@LMonth @Day, @YYYY");▼
//delink yyyy-mm-dd dates
ohc_regex(/\[\[@YYYY(?:\]\]-\[\[|-)@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");▼
ohc_regex(/@YYYY-\[\[@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");▼
//underscore and nbsp in linked dates
Line 128 ⟶ 132:
ohc_regex(/\[\[@Month(?:[ _]| )@ZD@th\]\]/gi, "@LMonth @Day");
ohc_regex(/\[\[@ZD@th(?:[ _]| )@Month\]\]/gi, "@Day @LMonth");
ohc_regex(/\[\[@month @dd(?:#[^|]+|)\|([^|\]]+)\]\]/gi, "$1");▼
ohc_regex(/\[\[@dd @month(?:#[^|]+|)\|([^|\]]+)\]\]/gi, "$1");▼
ohc_regex(/\[\[@month @yyyy(?:#[^|]+|)\|([^|\]]+)\]\]/gi, "$1");▼
// remove nowrap template from dm and md dates
Line 137:
ohc_regex(/(date[ ]*=[ ]*)\{\{(?:j|no ?(?:break|wrap))\|(?:@Month(?:[ _]| )@DD)( @yyyy|)\}\}/gi, '$1@LMonth @DD$2');
▲ //delink yyyy-mm-dd dates
▲ ohc_regex(/\[\[@YYYY(?:\]\]-\[\[|-)@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");
▲ ohc_regex(/@YYYY-\[\[@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");
▲ //delink full dates
▲ ohc_regex(/\[\[@Month (?:the\s)?@Day(?:\]\],? \[\[|, )@YYYY\]\]/gi, "@LMonth @Day, @YYYY");
//delink single dm or 'dth the m'
ohc_regex(/(?:the\s)?\[\[@Day@th?[\s_](?:of[\s_])?@Month\]\]/gi, "@Day @LMonth");
Line 154 ⟶ 142:
ohc_regex(/\[\[@Month[\s_](?:the[\s_])?@Day@th?\]\](?=\W)/gi, "@LMonth @Day");
ohc_regex(/\[\[(?:@
ohc_regex(/
//month+day+year pseudo-ISO dates
ohc_regex(/
ohc_regex(/
▲ //month+day piped
▲ ohc_regex(/(?:the\s)?\[\[@day[\s_](?:of[\s_])?@month\|([^\]]{1,30})\]\]/gi, "$1");
//'[[month day|xxXxx]]Xyyyy ' to 'month day, year'
Line 172 ⟶ 159:
ohc_regex(/\[\[@Day\s@Month\|@dd.@dd\]\].@YYYY/gi, "@Day @LMonth @YYYY");
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))?)\]\]/gi, '$1');
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\-_]
ohc_regex(/\[\[\d{1,2}@th[\s\-_]centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE)|)\|([^\]]{1,30})\]\]/gi, '$1');
Line 205 ⟶ 192:
ohc_regex(/(\[\[@yyyy[^|\]]+\|@yyyy)(\]\])( season)/gi, "$1$3$2");
//removed piped years when in full date (excepting disambiguated parentheses - updated 24/2/2012)
//Identify surprise or 'Easter egg' diversions linking months to year or "year in" articles.
Line 514 ⟶ 498:
//multiple calls for multiple dates within single citation
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD(<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
}
Line 522 ⟶ 505:
//multiple calls for multiple dates within single citation
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3");
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD(<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3");
}
Line 838 ⟶ 820:
//\|x=
regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
regex(/(<!--)([^<\{\}]*?)(-->)/gi, protect_function);
regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
Line 866 ⟶ 849:
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);
regex(/(\[\[)(4AD)(\]\]|\|)/gi, protect_function);
//retraining redirects containing a date
|