MediaWiki r48249 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r48248‎ | r48249 (on ViewVC)‎ | r48250 >
Date:01:07, 10 March 2009
Author:werdna
Status:resolved (Comments)
Tags:
Comment:
* (bug 4582) Provide preference-based autoformatting of unlinked dates with the dateformat
parser function.
Modified paths:

Diff [purge]

Loading diff…

Follow-up revisions

Rev.Commit summaryAuthorDate
r48254Tweak r48249 -- allow specification of the default format, and require the da...werdna05:19, 10 March 2009
r70651Revert r70533 and the piece of r70501 that it tried to fix. Note and open bug...platonides21:21, 7 August 2010

Comments

#Comment by Anomie (talk | contribs)   03:41, 10 March 2009

{{#formatdate:9 March 2009}} outputs the following:

9 <span class="mw-formatted-date" title="0009-03-20">March 20, 09</span>

Also, if you could throw in a magic word (like DEFAULTSORT does for category sort keys) to make #formatdate use a particular format for users with no preference, that would make it even more useful. Otherwise enwiki people will just complain "It's still no good because IP users will see mismatched dates".

#Comment by Werdna (talk | contribs)   05:19, 10 March 2009

Thanks for the feedback

Fixed in r48254.

#Comment by Tony1 (talk | contribs)   04:28, 10 March 2009

Is there a list of specs? Is there a demonstration? Has it been tested?

#Comment by Werdna (talk | contribs)   04:34, 10 March 2009

This is a very simple fix. Specs are "It applies the same magic applied to linked dates without linking them" (i.e. what I wrote in the commit message and release notes)

There was no need to set up a live demonstration, although you're welcome to do it yourself.

Like anything committed to subversion (we hope), it was tested before committing.

#Comment by Locke Cole (talk | contribs)   06:05, 10 March 2009

Would you like fries with that?

#Comment by UC Bill (talk | contribs)   15:16, 10 March 2009

First, a nitpick: Escaping closing braces is unnecessary unless you're within the context of an open brace, so your changes to the prx* lines don't actually do anything... however, if you just want to clean up the code to be easier to read, you should also change the prxISO1 (missed a set of closing braces there.)

More substantially, I'm not so sure about the changes you made to the case statements, getting rid of the checks on the "ISO" bits. Note that there's a transformation there from the 'j' or 'F' bits into their equivalent 'd' or 'm' form, which is no longer taking place in the changed version. I'll checkout a fresh copy of the code and try to come up with some test cases, but you might want to look into it as well.

Good work, by the way! I think this might make a template solution feasible, or at least be a step in that direction.


#Comment by UC Bill (talk | contribs)   15:20, 10 March 2009

Gah. I meant "brackets" not "braces" (gotta remember which are the square and which are the curly.. :)

#Comment by UC Bill (talk | contribs)   15:40, 10 March 2009

Ah, thanks Werdna for the explanation on enwiki. For the record, the 'j' and 'F' bits I was referring to are now taken care of before the case statements are even reached. I'll still checkout a fresh copy and run some test cases, if only to shut up the critics on enwiki who are complaining about the lack of transparency in the test/commit process. I expect the code will work fine, though.

#Comment by Brion VIBBER (talk | contribs)   23:03, 18 March 2009

This really needs parser test cases...

#Comment by Remember the dot (talk | contribs)   17:05, 20 March 2009

How would this function be used? Please give specific examples.

#Comment by Tony1 (talk | contribs)   14:54, 11 April 2009

Pity IP users and the vanishingly small proportion of registered users who choose a preference will see different displays: that is asking for trouble. Pity about the total failure to deal with all of the other major problems with the blue-wash autoformatting, like date ranges (getting the en dash, spaced or unspaced, right, and not requiring huge amounts of redundancy, such as "January 4 – January 6, 1980". And has it been tested, we all want to know.

#Comment by Werdna (talk | contribs)   15:18, 11 April 2009

With respect, what on Earth are you on about?

If there is a specific problem with this revision, please let me know and I'll endeavour to fix it. If you have a specific question, please ask it and I'll endeavour to answer it.

Random rants with no particular actionable statements will probably be ignored.

Status & tagging log