Template talk:Cost

Bug? Feature?
I see no way of fixing it, though, as tempates and ParserFunctions do not distinguish between the empty string (modulo whitespace) and lack of an argument. 82.165.253.73 08:12, 28 August 2006 (CDT)


 * You can distinguish. If the first parameter is undefined, then  will not equal  .  You could say it's a bug in the template's documentation rather than the implementation.  --Fyren 08:48, 28 August 2006 (CDT)

rewritten version incoming
There is a rewritten version at User:M.mendel/Templates/cost. It has the following advantages: Since a change of this template affects 500+ pages, I thought I'd ask for criticism and/or suggestions before I implement the change. Any takers? --◄mendel► 18:24, 6 October 2008 (UTC)
 * 1) The cost doesn't wrap, i.e. numbers and symbols always stay on the same line.
 * 2) The bug mentioned above is fixed.
 * 3) The new template can actually produce 12  0 ; this is not possible now.
 * 4) The old template adds  to produce 24  345 ; the new one gives a warning (as the old one should have done per the documentation).
 * 5) The template code is actually readable and works without complicated expressions.


 * Hope you don't mind, I changed your list to an ordered one so I can respond point-by-point.
 * Whoo!
 * Whoo!
 * Is that really necessary? Given a platinum value such as 12, most people will understand the implied 0.
 * What's your deal with huge, brightly-colored error messages anyway? :P
 * In defense of the original template, it was created before the StringFunctions extension was installed on GuildWiki, so it had to rely on the mathematical abilities of the ParserFunctions extension.
 * I don't see any problems with your version, and I can't think of any other possible improvements at this time. &mdash;Dr Ishmael [[Image:Diablo_the_chicken.gif]] 19:20, 6 October 2008 (UTC)
 * 3. It's a matter of symmetry (because 0 some  was possible even with the old template), and it might come in handy when there's a list of prices, most of which do have the gold part (especially if it is right-aligned). You can still produce just the platinum if you want by leaving the gold parameter empty.
 * 4. They have to look so ugly as to provide motivation to eliminate them asap. ;-) We ought to do a wiki search for the error phrase as soon as the change is through the job queue.
 * 5. That is no defense for using an arithmetic expression instead of ( < 1000) and no linebreaks.
 * Thank you.
 * I'm going to try a DPL query to feed all existing costs into a copy of the new template tomorrow morning, when the server is more responsive - most problems should become obvious (if it works). --◄mendel► 21:30, 6 October 2008 (UTC)