ढाँचा:Convinfobox

विकिपिडिया बठेइ
अन्वेषणमा जानुहाेस् खाेजमा जानुहाेस्
Template documentation[view] [edit] [history] [purge]
The template documentation below is transcluded from ढाँचा:Convinfobox/doc [edit]

This template is based on {{convert}}. It is intended as a meta-template for use in infoboxes. It accepts from four to seven unnamed parameters. Even parameters must be numerical (or empty) and specify the numerical value of a measurement and the intended precision of the conversion. Odd parameters must be unit codes as used in {{convert}}. Named parameters are the same as {{convert}}'s.

This template differs from {{convert}} in the following respects.

  • The units to convert to and the units to convert from must be specified (therefore there are no default convert-to units).
  • Feilds for the numerical value of a measurement may be left blank.
  • The default to to abbreiviate units (where abbreviations exist).
  • Range conversions are not available.

This template may be used when it is unknown in which direction the conversion is to be made. The direction is determined as shown in the following examples.

  • {{convinfobox|100|m2||sqft}} gives "100 m2 (1,100 sq ft)"
  • {{convinfobox||m2|100|sqft}} gives "{{convert/{{{d}}}|100||m2||s=|r={{{r}}}

|u=sq ft |n=square foot |h=square-foot |l=square feet |o=m2 |b=0.09290304 |j=-1.031970075-0}}"

Dual conversions[स्रोत सम्पादन]

Dual conversions may be performed by adding a fifth (possibly blank) and sixth unnamed parameter.

  • {{convinfobox|375|ml||impoz||usoz}} gives "{{convert/{{{d}}}|375||impoz usoz||s=|r={{{r}}}

|u=ml |n=millilit{{{r}}} |t=millilitre |o=impoz usoz |b=0.000001 |j=-6-0}}"

  • {{convinfobox||ml|40|impoz||usoz}} gives "{{Convert/{{{d}}}Imp|40||ml usoz||s=|r={{{r}}}

|u=fl oz |n=fluid ounce |h=fluid-ounce |o=ml usoz |b=0.0000284130625 |j=-4.546481953-0}}"

Paired units[स्रोत सम्पादन]

Length may be expressed in feet and inches.

  • {{convinfobox|180|cm||ft||in}} gives "{{convert/{{{d}}}|180||ftin|||||s=|r={{{r}}}

|u=सेन्टीमिटर |n=centimet{{{r}}} |t=centimetre |o=in |b=0.01 |j=-2-0}}"

  • {{convinfobox||cm|5|ft||in}} gives "{{convert/{{{d}}}|5||cm||||||s=|r={{{r}}}|d={{{d}}}

|u=फिट |n=foot |l=फिट |t=Foot (length) |o=m |b=0.3048 |j=-0-0}}"

  • {{convinfobox||cm||ft|120|in}} gives "{{convert/{{{d}}}|120||cm|||||s=|r={{{r}}}

|u=इन्च |n=inch |l=inches |o=mm |b=0.0254 |j=-1.595166283-0}}"

  • {{convinfobox||cm|5|ft|6|in}} gives "{{convert/{{{d}}}2|5|6|(5*12+6)*0.0254|1|cm||s=|r={{{r}}}

|U=फिट |N=foot |L=फिट |T=Foot (length) |a=n |u=इन्च |n=inch |l=इन्च |o=m |j=-2+0}}"

  • {{convinfobox||ft||in|180|cm}} gives "{{convert/{{{d}}}|180||ftin|||||s=|r={{{r}}}

|u=सेन्टीमिटर |n=centimet{{{r}}} |t=centimetre |o=in |b=0.01 |j=-2-0}}"

  • {{convinfobox|5|ft||in||cm}} gives "{{convert/{{{d}}}2|5|0|(5*12+0)*0.0254|1|cm||s=|r={{{r}}}

|U=फिट |N=foot |L=फिट |T=Foot (length) |a=n |u=इन्च |n=inch |l=इन्च |o=m |j=-2+1}}"

  • {{convinfobox||ft|120|in||cm}} gives "{{convert/{{{d}}}|120||cm|||||s=|r={{{r}}}

|u=इन्च |n=inch |l=inches |o=mm |b=0.0254 |j=-1.595166283-0}}"

  • {{convinfobox|5|ft|6|in||cm}} gives "{{convert/{{{d}}}2|5|6|(5*12+6)*0.0254|1|cm||s=|r={{{r}}}

|U=फिट |N=foot |L=फिट |T=Foot (length) |a=n |u=इन्च |n=inch |l=इन्च |o=m |j=-2+0}}"

Similarly, mass may be expressed in pounds and ounces.

  • {{convinfobox|8.5|kg||lb||oz}} gives "{{convert/{{{d}}}|8.5||lboz|||||s=|r={{{r}}}

|u=किलोग्राम |n=kilogram |o=lb |b=1 |j=0-0}}"

Mass may also be expressed in stone and pounds.

  • {{convinfobox|65|kg||st||lb}} gives "{{convert/{{{d}}}|65||lb stlb|||||s=|r={{{r}}}

|u=किलोग्राम |n=kilogram |o=lb |b=1 |j=0-0}}"

|u=पाउण्ड |n=pound |t=pound (mass) |o=कि.ग्रा. |b=0.45359237 |j=-0-0}}"

Leaving all numerical feilds blank[स्रोत सम्पादन]

If all numerical value fields are left blank the template returns nothing.

  • {{convinfobox||m2||sqft}} gives ""
  • {{convinfobox||ml||impoz||usoz}} gives ""

Specifying more than one value[स्रोत सम्पादन]

The template currently bases conversions on the first non-blank numerical value ignoring any secondary or tertiary values.

  • {{convinfobox|100|m2|100|sqft}} gives "100 m2 (1,100 sq ft)"
  • {{convinfobox|375|ml|40|impoz||usoz}} gives "{{convert/{{{d}}}|375||impoz usoz||s=|r={{{r}}}

|u=ml |n=millilit{{{r}}} |t=millilitre |o=impoz usoz |b=0.000001 |j=-6-0}}"

  • {{convinfobox|375|ml||impoz|32|usoz}} gives "{{convert/{{{d}}}|375||impoz usoz||s=|r={{{r}}}

|u=ml |n=millilit{{{r}}} |t=millilitre |o=impoz usoz |b=0.000001 |j=-6-0}}"

  • {{convinfobox||ml|40|impoz|32|usoz}} gives "{{Convert/{{{d}}}Imp|40||ml usoz||s=|r={{{r}}}

|u=fl oz |n=fluid ounce |h=fluid-ounce |o=ml usoz |b=0.0000284130625 |j=-4.546481953-0}}"

Rounding[स्रोत सम्पादन]

As with {{convert}} rounding can be done automatically or manually by specifying the precision and/or number of significant figures in the converted value. The number of significant figures can be determined by the parameter sigfig. The precision can be determined by the fifth (if there is no sixth) or seventh (if there is a sixth) unnamed parameter as shown in the examples below.

  • {{convinfobox|100|m2||sqft|4}} gives "100 m2 (1,076.3910 sq ft)"
  • {{convinfobox|100|m2||sqft|sigfig=4}} gives "100 m2 (1,076 sq ft)"
  • {{convinfobox||ml|40|impoz||usoz|2}} gives "{{Convert/{{{d}}}Imp|40||ml usoz|2|s=|r={{{r}}}

|u=fl oz |n=fluid ounce |h=fluid-ounce |o=ml usoz |b=0.0000284130625 |j=-4.546481953-0}}"

  • {{convinfobox||ml|40|impoz||usoz|sigfig=3}} gives "{{Convert/{{{d}}}Imp|40||ml usoz||s=|r={{{r}}}

|u=fl oz |n=fluid ounce |h=fluid-ounce |o=ml usoz |b=0.0000284130625 |j=-4.546481953-0}}"