User:Ohconfucius/test/MOSNUM dates.js: Difference between revisions

Content deleted Content added
Restored revision 1297375849 by Ohconfucius (talk)
aligning both production and test scripts
Line 31:
},
{
name: "BIGENDIAN datesDMY_cs1=ly",
tooltip: "Access & archive dates",
script: ohc_refs_to_yyyymmddohc_dmy_cs1_ly_driver
},
{
name: "HelllMDY_cs1===oly",
tooltip: "say hello",
script: ohc_hello_driverohc_mdy_cs1_ly_driver
},
{
Line 236:
// Identify surprise or 'Easter egg' diversions linking months to year or "year in" articles.
.ohc_regex(/\[\[\d{1,4}#[^|\]]+\|@Month\]\]/gi, "@LMonth")
// .ohc_regex(/\[\[@yyyy \w[^|\]]{3,12}\|@Year\]\]/gi, "@Year") //disable easter egg removal per request 5 November 2022
 
// month and day piped
Line 808:
// replace ISO dates (within parentheses) only within refs
.ohc_regex(/(<ref[^>]*>[^<]+?)([ ]\()@YYYY-@MM-@DD(\))(\W[^<]*?<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3$4");
 
function ohc_hello_driver(editor) {
editor
// Add a tag to the summary box
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)January (\d{1}), (\d{4})/gi, "$1$3-01-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)January (\d{2}), (\d{4})/gi, "$1$3-01-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)February (\d{1}), (\d{4})/gi, "$1$3-02-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)February (\d{2}), (\d{4})/gi, "$1$3-02-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)March (\d{1}), (\d{4})/gi, "$1$3-03-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)March (\d{2}), (\d{4})/gi, "$1$3-03-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)April (\d{1}), (\d{4})/gi, "$1$3-04-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)April (\d{2}), (\d{4})/gi, "$1$3-04-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)May (\d{1}), (\d{4})/gi, "$1$3-05-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)May (\d{2}), (\d{4})/gi, "$1$3-05-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)June (\d{1}), (\d{4})/gi, "$1$3-06-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)June (\d{2}), (\d{4})/gi, "$1$3-06-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)July (\d{1}), (\d{4})/gi, "$1$3-07-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)July (\d{2}), (\d{4})/gi, "$1$3-07-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)August (\d{1}), (\d{4})/gi, "$1$3-08-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)August (\d{2}), (\d{4})/gi, "$1$3-08-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)September (\d{1}), (\d{4})/gi, "$1$3-09-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)September (\d{2}), (\d{4})/gi, "$1$3-09-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)October (\d{1}), (\d{4})/gi, "$1$3-10-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)October (\d{2}), (\d{4})/gi, "$1$3-10-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)November (\d{1}), (\d{4})/gi, "$1$3-11-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)November (\d{2}), (\d{4})/gi, "$1$3-11-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)December (\d{1}), (\d{4})/gi, "$1$3-12-0$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\|\s*(?:archive|access)-?date\s*=\s*)December (\d{2}), (\d{4})/gi, "$1$3-12-$2") // conversion of mdy dates to ymd within citation templates
.replace(/(\{\{use (?:mdy|dmy) dates)(?:\|cs1-dates=\w{1,2}|)(\|[^\}\|]+\}\})/gi, "$1|cs1-dates=ly$2");
ohc_hello_driver_summary(editor);
}
 
Line 1,226 ⟶ 1,195:
return res;
});
 
function ohc_hello_driver_summary(editor) {
editor
.options({ minor: true })
.appendEditSummary("HELLO")
.clickDiff();
}
 
Line 1,318 ⟶ 1,280:
ohc_ISO_to_dmy_in_citations(editor);
ohc_unprotect_dates(editor);
 
ohc_refs_to_yyyymmdd(editor);
ohc_MOSNUM_edit_summary(editor);
}
 
function ohc_all_to_mdy_driver(editor) {
ohc_extend_editor(editor);
 
ohc_delink_dates(editor);
ohc_protect_dates(editor);
ohc_fix_unambiguous_dates(editor);
ohc_body_dates_to_mdy(editor);
ohc_delink_ISO_to_mdy(editor);
//ohc_delink_year_in_X(editor);
ohc_customize_all_to_mdy();
ohc_ISO_to_mdy_in_citations(editor);
ohc_unprotect_dates(editor);
 
ohc_MOSNUM_edit_summary(editor);
 
function ohc_hello_driverohc_dmy_cs1_ly_driver(editor) {
ohc_extend_editor(editor);
 
ohc_delink_dates(editor);
ohc_protect_dates(editor);
ohc_fix_unambiguous_dates(editor);
ohc_body_dates_to_dmy(editor);
ohc_delink_ISO_to_dmy(editor);
//ohc_delink_year_in_X(editor);
ohc_customize_all_to_dmy(editor);
ohc_ISO_to_dmy_in_citations(editor);
ohc_unprotect_dates(editor);
ohc_refs_to_yyyymmdd(editor);
ohc_MOSNUM_edit_summary(editor);
 
function ohc_hello_driver_summaryohc_mdy_cs1_ly_driver(editor) {
ohc_extend_editor(editor);