Jump to content

User:Ohms law/Convert

From Wikipedia, the free encyclopedia
{{Convert/{{{d}}}And|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|s={{{s|}}}
|U=mi
|N=mile
|T=Mile
|u=ft
|n=foot (unit)
|l=feet
|a=5280<!-- Feet per mile -->
|b=.3048<!-- meters per foot -->
|j=-0.5159850373-{{{j}}}}}</includeonly><noinclude>

Ohms,

It looks pretty good. Here are a couple of things I forgot to mention.

  • u stands for unit symbol/abbreviation
  • n stands for unit name
  • l stands for plural
  • h stands for hyphenated form
  • t stands for article title

I guess you figured most of this out. What you wouldn't have easily guessed is that l, h and t are optional (u is sort of optional but that's another story). There are no hs here, right, that's because these are both one-word unit names (you'd need an h for square feet). Now, the way you've got it here, it's going to link to foot instead of foot (unit). You need a t=foot (unit) but the T=Mile is not necessary nor is L=miles (you only need ls if the plural is "irregular" (where "irregular" includes plurals formed by adding "es" as in "inches"))

You probably also figured out that capitals are for the big units and lower-case are for the small. You've chosen a bit of a tricky one to start with; single units are easier (all lower-case in that case). Also the bs are easier with single units ... for miles & feet is b the number of metres in a mile or in a foot? Also you don't have to worry about as either ... P.S. you got the wrong a for miles and feet, 12 is good for feet and inches ... have you guessed yet? If not, have a look here.

Now to parameter j. It stands for jump ... for want of a better thing to call it ... as in a sort of jump in precision ... sort of how far would you move the decimal point in order to keep the same precision? So j = log10b. If I were creating the template again from scratch, I wouldn't have a j but there was no parser function for logarithms four years ago. One of these days I'd like to get rid of it, it makes it difficult for people to add units.

I'm not quite sure where you got the LoffAoffDbSoff from but it should be {{{d}}}And. These unit templates don't have a pre-determined place to go, you have to tell them where to go, this is how we can use the same one for input and output units, various different display options, in other templates like {{var}} & {{endurance}}, etc. Also don't put the km there, default outputs are given by o but this is an output-only template (if you want the template to accept miles & feet as input we'll have to adjust {{convert/mi}}).

Good luck. JIMp talk·cont 23:59, 21 June 2011 (UTC)

Getting warmer ... n for name, t for title in the case of miles same but not for feet. JIMp talk·cont 00:29, 22 June 2011 (UTC)

Category:Subtemplates of Template Convert