script: ohc_all_to_mdy_driver
},
/*{
name: "DMY_cs1=lyExpand ref dates",
tooltip: "AccessExpand &month archivenames dateswithin refs",
script: ohc_dmy_cs1_ly_driverohc_expand_ref_dates_driver
},
{
name: "MDY_cs1=lyExpand all dates",
tooltip: "sayExpand hellomonth names throughout",
script: ohc_mdy_cs1_ly_driverohc_expand_all_dates_driver
},*/
{
name: "US-slash dates",
.replace(/\[\[(\d{1,3}0)\'?s\]\]/g, "$1s")
.replace(/\[\[\d{1,3}0\'?s?\|([^\]]{1,30})\]\]/g, "$1")
// .replace(/\[\[(\d{21,3}0)\'?(s)?\s(AD|BC|CE|BCE)\]\]/gi, "$1$2 $3")
// .replace(/\[\[(\d{1,4}[\s_]?)(AD|BC|CE|BCE)\]\]/gi, "$1$2")
.replace(/\[\[(AD|BC|CE|BCE)([\s_]?)(\d{1,4})\]\]/gi, "$1$2$3")
.ohc_regex(/([-–])\[\[\s?@yyyy\s?\|\s?(\d{2,4})\s?\]\]/gi, "$1$2") // piped year
// 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
editor
// ISO dates within single citation
//.ohc_regex(/(\|\s*(?:publication|archive|access|air|designation\d?_|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Day @Month @YYYY"); //regex which converts ymd to dmy or mdy throughout (within citation templates)
.ohc_regex(/(\|\s*(?:publication|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Day @Month @YYYY");
}
editor
// ISO dates within single citation
//.ohc_regex(/(\|\s*(?:publication|archive|access|air|designation\d?_|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Month @Day, @YYYY"); //regex which converts ymd to dmy or mdy throughout (within citation templates)
.ohc_regex(/(\|\s*(?:publication|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Month @Day, @YYYY");
}
}
function ohc_refs_to_yyyymmddohc_Bigendian_ref_dates(editor) {
editor
// Add a tag to the summary box
.replace(/(\{\{use (?:mdy|dmy) dates)(?:\|cs1-dates=\w{1,2}|)( \s*\| date=[^\}\|]+ )(?=\}\})/gi, "$1 $2|cs1-dates= lyy$2"); ▼
.ohc_regex(/(\|\s*(?:archive|access)-?date\s*=\s*)@Day @Month @YYYY/gi, "$1@YYYY-@MM-@DD") // conversion of dmy dates to ymd within citation templates
.ohc_regex(/(\|\s*(?:archive|access)-?date\s*=\s*)@Month @Day, @YYYY/gi, "$1@YYYY-@MM-@DD") // conversion of mdy dates to ymd within citation templates
▲ .replace(/(\{\{use (?:mdy|dmy) dates)(?:\|cs1-dates=\w{1,2}|)(\s*\|date=[^\}\|]+)(?=\}\})/gi, "$1$2|cs1-dates=ly");
}
}
function ohc_dmy_cs1_ly_driverohc_dmy_publication_dates_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_dmyohc_customize_body_to_dmy(editor);
//ohc_delink_year_in_Xohc_dmy_publication_dates(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_mdy_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_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_refs_to_yyyymmdd(editor);
ohc_MOSNUM_edit_summary(editor);
}
function ohc_bigendian_driver(editor) {
ohc_refs_to_yyyymmdd(editor);
ohc_bigendien_edit_summary(editor);
}
function ohc_dmy_publication_dates_driver(editor) {
ohc_dmy_publication_dates(editor);
ohc_MOSNUM_edit_summary(editor);
|