User:Ohconfucius/script/MOSNUM dates: Difference between revisions

Content deleted Content added
mNo edit summary
Tag: Reverted
indeed, the parameter is "cs1-dates"
 
(11 intermediate revisions by 3 users not shown)
Line 1:
{{Editnotice
{{Message
| id = userpageedn
| header = New Features as of 26 June 2025
| headerstyle = font-size: 150%;
| text = Hello! the user script [[User:Ohconfucius/script/MOSNUM_dates.js]] has been updated to add new features in further support of [[WP:MOSNUM]] in articles. Two new functions have been added: <code>DMY_cs1=ly</code> and <code>MDY_cs1=ly</code> where dates in the body of the text (and publication dates within citation templates, plus all "loose dates" inside references) are converted to DMY or MDY; access dates and archive dates align to ymd (1978-07-14); adds template parameter {{para|cs1-dates}} with a matching value "ly".
 
Users are reminded to respect the [[WP:RETAIN|existing format in place]] and abide by [[WP:CONSENSUS]] when using this script.
| textstyle = font-size: 120%;
| image = File:New-Bouncywikilogo.gif
| imagesize = 90px
| style = border:DarkRed solid 2px; background:var(--background-color-neutral,white); color:var(--color-base,black);
}}{{Message
| bgcolor = lightblue
| border-color = royalblue
Line 14 ⟶ 25:
 
{{shortcut|WP:Mosnumscript|WP:MOSNUMscript}}
[[File:Update screenshot for activating MOSNUM dates.png|thumb|280px|Sidebar ___location of the script buttons afterwhen you havein clicked on the 'ToolsEdit' trianglemode]]
 
== Overview ==
Line 21 ⟶ 32:
MOSNUM allows one other format to be used in articles &ndash; but only in tables and reference sections.
<!-- '''''NOTE:''' Functions converting dates within citation templates has been withdrawn now that [[MediaWiki|MW]] software engine renders date formats automatically'' -->
There are modes that allow the user to select whether to treat body dates only or body and reference sections:
# '''all datesDATES to dmy''' &ndash; dates in the body of the text as well as in the reference sections are converted to "14 July 1978" or similar.
# '''all datesDATES to mdy''' &ndash; as above. dates are converted to "July 14, 1978" or similar.
# '''DMY_cs1=ly''' &ndash; dates in the body of the text are converted to dmy ("14 July 1978" or similar); access dates and archive dates to ymd (1978-07-14); adds template parameter {{para|cs1-dates}} with a matching value "ly".
# '''<s>Big endian ref dates</s>''' button now disabled. Users are invited to manually add {{para|cs1-dates}} parameter to {{tl|Use dmy dates}} or {{tl|Use mdy dates}} causing applicable dates to be rendered in ''{{date|{{date}}|iso}}'' YMD format
# '''MDY_cs1=ly''' &ndash; as above. prose and publication dates are aligned to mdy ("July 14, 1978" or similar); access dates and archive dates to ymd (1978-07-14); adds template parameter {{para|cs1-dates}} with a matching value "ly".
 
In addition, there are the following modes to convert slash or contracted dates into the desired format:
<!--
Line 33 ⟶ 44:
-->#'''US-slash dates''' &ndash; converts dates that use slash or decimal separators in formats commonly used in the US into '''mdy''' dates ''viz'': <code>mm/dd/yy</code>, <code>mm/dd/yyyy</code>, <code>mm.dd.yy</code> or <code>mm.dd.yyyy</code>
# '''UK-slash dates''' &ndash; converts dates that use slash or decimal separators in formats commonly used in the UK, Europe and elsewhere into '''dmy''' dates ''viz'': <code>dd/mm/yy</code>, <code>dd/mm/yyyy</code>, <code>dd.mm.yy</code> or <code>dd.mm.yyyy</code>
''* '''Note''': In these latter 2 cases, false positives are more likelypossible because the protection mechanism of the script is bypassed, meaning the regex will act on dates in instances other than where the {{para|date}} parameter is used''
 
== History ==
Line 46 ⟶ 57:
** delinks all dates and date fragments, including day-month strings, days, months, decades, centuries,
** converts all these date fragments to the same format, either dd mmm yyyy or mmm dd, yyyy, at the option of the user
** yyyy-mmm-dd dates within accessdate and archivedate are not acted upon, but inconsistent (out of place) dates – dd mmm yyyy or mmm dd, yyyy will be converted.
** removes ordinal suffixes and constructions such as '<span style="color:orange;">the</span> 5<span style="color:orange;">th of</span> September', 'December 25<span style="color:orange;">th</span>' or 'October <span style="color:orange;">of</span> 2003'
** adds commas where necessary (e.g. February 28, 2001)
Line 53 ⟶ 65:
* It converts other often used (but not MOSNUM-compliant) date formats within the references section, such as dd-mm-yyyy or dd-mmm-yyyy to the chosen prevailing format used in the rest of the article.
* It makes certain fixes that may be identified as [[:Category:CS1 errors: dates|CS1 dates errors]]
* cs1=ly buttons, of which there are two, insert the eponymous template parameters, and will convert underlying dates within {{para|accessdate}} and {{para|archivedate}} to ymd.
* <s>It also allows users to choose to convert dates within only the body of the article, as is permitted for reference sections (where yyyy-mm-dd dates are common) to have different dates, or throughout the article.</s> Now disabled. CS1 now manages the date rendering by [[Help:Citation_Style_1#Auto-formatting_citation_template_dates|auto-formatting citation template dates]] using parameters within the {{tl|use dmy dates}} and {{tl|use mdy dates}} templates, so this can be used to fine-tune the rendering.
 
<!-- * ISO-style dates (yyyy-mm-dd) which are outside <nowiki><ref></ref></nowiki> tags are not acted upon by the script -->
-->
 
The script adds or updates a non-displaying template {{tl|use mdy dates}} or {{tl|use dmy dates}} depending on the conversion used. This tagging allows for WM software engine to render date formats automatically in conformity with tagged format). It also facilitates future maintenance by bot by script [[WP:AWB|AWB]].
Line 71 ⟶ 83:
 
=== Optional auto-formatting citation template dates ===
Script default is without parameter, inall whichdates case date isare aligned to the prevailing style, indicated – dmy or mdy.
 
Notwithstanding the available buttons, [[Help:Citation Style 1|Citation Style 1]] and [[Help:Citation Style 2|2]] (collectively cs1|2) templates automaticallycan be configured to render dates ({{para|date}}, {{para|access-date}}, {{para|archive-date}}, etc) in the style specified by this template. as Because it is allowedpermitted by [[WP:MOSDATES]], the cs1|2 templates can automatically format dates in a variety of styles. Editors may choose how cs1|2 templates render dates by the use of {{para|cs1-dates|&lt;{{var|keyword}}>}}.
{{#lst:Help:Citation Style 1|auto_date_format_table}}
 
Line 82 ⟶ 94:
 
Feedback is appreciated at [[User Talk:Ohconfucius]]. Please report any false negatives as well as false positives you may detect.
 
{{User:Ohconfucius/script/install}}
 
== Actions and test ==