Wikipedia talk:Date formattings/script/MOSNUM dates
![]() | This is the "master" version of my MOSNUM script where all new ideas would go. These changes would go into production version only after additional testing. The workflow proposed, to allow more users to collaborate and to facilitate bug fixing, is something as follows:
|
Some questions about changes by Ohconfucius before 12 May
This changeset contains changes to Ohconfucius' test script that I didn't understand fully. Let's have some review and then incorporate them to the main script if everything is OK :)
1
Line 741:
- regex(/\[\[(AD|BC|CE|BCE)([\s_]?)(\d{1,4})\]\]/gi, '$3$2$1');
+ regex(/\[\[(AD|BC|CE|BCE)([\s_]?)(\d{1,4})\]\]/gi, '$1$2$3');
Why don't we reorder dates into consistent format like 123 AD after unlinking? The change removes this feature. 1exec1 (talk) 21:11, 3 June 2012 (UTC)
- I suspected that there would be a greater possibility of false positives by that approach, especially when the years are not four digits, so I opted to do it straight out of the links. --Ohconfucius ¡digame! 02:44, 4 June 2012 (UTC)
- Agree. Though I think it's worth to remove this rule altogether, because it would only match false-positives. I've already removed all links that point to the year pages. 1exec1 (talk) 16:06, 4 June 2012 (UTC)
2
Line 762:
- ohc_regex(/\[\[@day[\s_](?:of[\s_])?@month\|([^\]]{1,30})\]\]/gi, "$1");
+ ohc_regex(/\[\[@day[\s_](?:st|nd|rd|th|)[\s_](?:of[\s_])?@month\|([^\]]{1,30})\]\]/gi, "$1");
Wouldn't @th? be sufficient instead of (?:st|nd|rd|th|)? 1exec1 (talk) 21:11, 3 June 2012 (UTC)
- Possibly. I'll put that in. --Ohconfucius ¡digame! 02:44, 4 June 2012 (UTC)
3
Line 762:
- ohc_regex(/\[\[@Day\]\]/gi, "@Day");
+ // ohc_regex(/\[\[@Day\]\]/gi, "@Day");
Is there's something bad with unlinking days? 1exec1 (talk) 21:11, 3 June 2012 (UTC)
- Er, not as such, but I didn't see the utility in doing lone 2-digit numbers only on the date range (ie 1-31). All numbers up to at least 2020 should be unlinked. I already have the following in the script:
regex(/\[\[([12]\d{3}|\d{1,3})\]\]/gi, '$1');
- Ok, then it's probably worth to remove it. 1exec1 (talk) 16:11, 4 June 2012 (UTC)
4
Line 875 and 881:
+ ohc_regex(/(\()@YYYY[-–]@MM[-–]@DD(\))/gi, '$1@Day @Month @YYYY$2');
...
+ ohc_regex(/(\()@YYYY[-–]@MM[-–]@DD(\))/gi, '$1@Month @Day, @YYYY$2');
What's the reason for these additions? Was it that multiple dates within the same citation weren't converted? If it is so, then this change isn't necessary, as I've added proper fix for this problem. 1exec1 (talk) 21:11, 3 June 2012 (UTC)
- Yes, palliative to correct ISO dates within simple parentheses that were not converted. It's a very specific string that is also very common, so I added that line. --Ohconfucius ¡digame! 02:49, 4 June 2012 (UTC)
- But this regex would convert ISO dates not only in citations, but everywhere. Is that by intention? If not, the regexes within
ohc_ISO_to_dmy_in_references()
should handle all ISO dates within references already. Are there any cases when they don't work? 1exec1 (talk) 16:23, 4 June 2012 (UTC)
- But this regex would convert ISO dates not only in citations, but everywhere. Is that by intention? If not, the regexes within
5
Line 898:
- ohc_regex(/\{\{date\|(@yyyy-@zm-@zd)(?:\|dmy|)\}\}/gi, "$1"); //Template:date converts to dmy by default
+ // ohc_regex(/\{\{date\|(@yyyy-@zm-@zd)(?:\|dmy|)\}\}/gi, "$1"); //Template:date converts to dmy by default
What was the problem with the date template?1exec1 (talk) 16:37, 4 June 2012 (UTC)
6
Lines 898 and 909:
+ regex(/([^\d\w\/\-%,])@YYYY-@MM-@DD(<\s?\/ref.*?>)/g, '$1@Day @Month @Year$2');
...
+ regex(/([^\d\w\/\-%,])@YYYY-@MM-@DD(<\s?\/ref.*?>)/g, '$1@Month @Day, @Year$2');
(Note to myself): These aren't necessary; it's better to update regexes in ohc_ISO_to_dmy_in_references()
. 1exec1 (talk) 16:37, 4 June 2012 (UTC)
...
I'll add more later. 1exec1 (talk) 21:11, 3 June 2012 (UTC)