Шаблон:Convert/док — разлика између измена
Садржај обрисан Садржај додат
Нема описа измене |
мНема описа измене |
||
Ред 1:
{{documentation subpage
Template convert
Statistics on total tc's:
2014-09-05 673940
Ред 8:
2016-05-25 789091
2016-11-17 832994
2017-07-29 872000
2017-12-15 902231
2018-12-27 957770
2019-01-12 960769
2019-01-01 by TDmonthly error report: Page [article] count: 651064; Transclusion count: 2878293
-->
{{hatnote|For currency conversion into US dollars, see [[Template:To USD]]}}
{{#ifeq:{{FULLPAGENAME}}|Template:Convert|{{high-risk| {{formatnum:960000}}+ }}}}
{{Transwiki guide |small=yes |text=See [[Template:Convert/Transwiki guide|'''this information''']] on copying this template and modifying it for use on another wiki.}}
{{Lua|Module:Convert}}
'''Template {{tl|convert}}''' ''calculates
:<code><nowiki>{{convert|2|km|mi}}</nowiki></code> → {{convert|2|km|mi}} <small>(km entered, so converted into mile)</small>
:<code><nowiki>{{convert|7|mi|km}}</nowiki></code> → {{convert|7|mi|km}} <small>(mi entered, so converted into km)</small>
''Numbers'' can be rounded, ''units'' can be abbreviated into symbols:
:<code><nowiki>{{convert|2|km|mi|2|abbr=on}}</nowiki></code> → {{convert|2|km|mi|2|abbr=on}}
:<code><nowiki>{{convert|7|mi|km|2|abbr=on}}</nowiki></code> → {{convert|7|mi|km|2|abbr=on}}
Value ''ranges'' can be entered using <code>|to|...</code> or <code>|-|...</code>:
:<code><nowiki>{{convert|2|to|5|km|mi}}</nowiki></code> → {{convert|2|to|5|km|mi}}
:<code><nowiki>{{convert|2|-|5|km|mi}}</nowiki></code> → {{convert|2|-|5|km|mi}}
Combined effect example:
:<code><nowiki>{{convert|2|-|5|km|mi|2|abbr=on}}</nowiki></code> → {{convert|2|-|5|km|mi|2|abbr=on}}
:<code><nowiki>{{convert|2|and|5|km|mi|sigfig=3|abbr=off}}</nowiki></code> → {{convert|2|and|5|km|mi|sigfig=3|abbr=off}}
{{hatnote|See [[Help:Convert]] for more detailed, technical information}}
==Units to convert==
{{hatnote|See also: [[Template:Convert/list of units|Complete list of units for {{tlf|Convert}}]]}}
Enter units to convert ''from'' ''into'':
* <code><nowiki>{{convert|1|lb|kg}}</nowiki></code> → {{convert|1|lb|kg}}
:[[International System of Units|SI]] units generally accept prefixes, like "m" for milli (10<sup>−3</sup>), and "M" for mega (10<sup>6</sup>)
:For "per" units, use "/" (slash): kg/ha
:For three-unit units, etc., see {{cl|Convert-like templates}}
==Unit name or symbol (abbreviation): ''1 pound'' or ''1 lb''?==
By default, the first
* <code><nowiki>{{convert|1|lb|kg}}</nowiki></code> → {{convert|1|lb|kg}}
Using {{para|abbr|in}} is the ''reverse behaviour'' to the default:
*<code><nowiki>{{convert|1|lb|kg|abbr=in}}</nowiki></code> → {{convert|1|lb|kg|abbr=in}}
To abbreviate both or neither:
* <code><nowiki>{{convert|1|lb|kg|abbr=on}}</nowiki></code> → {{convert|1|lb|kg|abbr=on}}
* <code><nowiki>{{convert|1|lb|kg|abbr=off}}</nowiki></code> → {{convert|1|lb|kg|abbr=off}}
===Convenience: {{tlf|cvt}} has {{para|abbr|on}} by default===
Template {{tl|cvt}} is
:<code><nowiki>{{cvt|1|lb|kg}}</nowiki></code> → {{cvt|1|lb|kg}}
is
:<code><nowiki>{{convert|1|lb|kg|abbr=on}}</nowiki></code> → {{cvt|1|lb|kg|abbr=on}}
==Adjective: ''a 10-mile distance''==
Use {{para|adj|on}} to produce the
* <code><nowiki>A {{convert|10|mi|km|adj=on}} distance</nowiki></code> → A {{convert|10|mi|km|adj=on}} distance.
Default behaviour, for comparison:
* <code><nowiki>{{convert|10|mi|km}} to go</nowiki></code> → {{convert|10|mi|km}} to go.
Even with {{para|abbr|on}}, as per [[MOS:UNITSYMBOLS|Manual of Style]], no hyphen is produced with unit symbols.
=={{anchor|Rounding}}Rounding: ''100 ft'' is ''30 m'' or ''30.5 m'' or ''30.48 m''?==
{{hatnote|See {{section link|Help:Convert#Rounding}} for a more mathematical description of the rounding options}}
By definition, 100 ft equals {{convert|100|ft|m|sigfig=4|disp=out}}. In practical use, it is common to round the calculated metric number. With that, there are several possibilities.
===Default rounding===
By {{tlf|Convert}} default, the conversion result will be rounded either to precision comparable to that of the input value (the number of digits after the decimal point—or the negative of the number of non-significant zeroes before the point—is increased by one if the conversion is a multiplication by a number between 0.02 and 0.2, remains the same if the factor is between 0.2 and 2, is decreased by 1 if it is between 2 and 20, and so on) or to two significant
{| class="wikitable"
Линија 59 ⟶ 82:
|-
|<code><nowiki>{{convert|123|ft|m|-1}}</nowiki></code> || {{convert|123|ft|m|-1}} ||
|-
|<code><nowiki>{{convert|123|ft|m}}</nowiki></code> || {{convert|123|ft|m}} || same output as with 0 (below)
|-
|<code><nowiki>{{convert|123|ft|m|0}}</nowiki></code> || {{convert|123|ft|m|0}} ||
Линија 64 ⟶ 89:
|<code><nowiki>{{convert|123|ft|m|1}}</nowiki></code> || {{convert|123|ft|m|1}} ||
|-
|<code><nowiki>{{convert|
|-
|<code><nowiki>{{convert|500|ft|m|-1}}</nowiki></code> || {{convert|500|ft|m|-1}} ||
|-
|<code><nowiki>{{convert|500|ft|m}}</nowiki></code> || {{convert|500|ft|m}} || same output as with −1 (above), because the conversion factor is between 0.2 and 2 (hence, it should produce same double-zero precision (−2) as in the input value), but the conversion must produce two significant digits at a minimum (hence, a higher single-zero precision (−1) is used)
|-
|<code><nowiki>{{convert|500|ft|m|0}}</nowiki></code> || {{convert|500|ft|m|0}} ||
|-
|<code><nowiki>{{convert|500|ft|m|1}}</nowiki></code> || {{convert|500|ft|m|1}} ||
|-
|<code><nowiki>{{convert|500|ft|m|2}}</nowiki></code> || {{convert|500|ft|m|2}} || exact value is 152.4 m
|-
|<code><nowiki>{{convert|
|-
|<code><nowiki>{{convert|500|ft|
|-
|<code><nowiki>{{convert|500|ft|
|}<!--NOTE: rows require "nowiki", using {{ disappears. -->
Линија 86 ⟶ 121:
Default behaviour, for comparison:
* <code><nowiki>{{convert|1200|ft|m}}</nowiki></code> → {{convert|1200|ft|m}}
Setting {{para|sigfig
* <code><nowiki>{{convert|1200|ft|m|sigfig=0}}</nowiki></code> → {{convert|1200|ft|m|sigfig=0}} {{nay}}
===Round to a multiple of 5: ''15'', ''20'', ''25'', ...===
Линија 110 ⟶ 145:
The fraction is reduced when possible:
* <code><nowiki>{{convert|8|cm|in|frac=100}}</nowiki></code> → {{convert|8|cm|in|frac=100}}
Default behaviour
* <code><nowiki>{{convert|
==={{anchor|Rounding temperatures}}
In temperatures, the conversion will be rounded either to the precision comparable to that of the input value or to that which would give three significant figures when expressed in kelvins, whichever is more precise.
#{{#invoke:DemoTemplate|convert|10,000|C|F K}}
Линија 120 ⟶ 155:
#{{#invoke:DemoTemplate|convert|-272|C|F K}}
#{{#invoke:DemoTemplate|convert|-272|C}}
#{{#invoke:DemoTemplate|convert|
#{{#invoke:DemoTemplate|convert|0|C|F K}}
Линија 129 ⟶ 164:
:{{#invoke:DemoTemplate|convert|10000|C|0}}
The precision of the input number in example (2) is six, so the precision of the Fahrenheit output is, whereas before, Kelvins had determined it to be three. Examples (3) and (4) show how this can be hidden and generate questions, but it occurs there because the Kelvins conversion generated two fractional parts. (Before it was the input number that generated the fractional part.) In example (3) the three input digits converted
===Rounding input===
There is limited support for rounding the displayed ''input'' number. The rounding takes place ''after'' conversion, so the output is based on the full-precision input. This is useful when the input is produced by {{tlc|#expr:}} or otherwise available to a higher precision than is usefully displayed, and it's desirable to avoid double-rounding.
To round the input to a specified number of digits after the decimal point, use one of the parameters:
* {{para|adj|ri0}}
* {{para|adj|ri1}}
* {{para|adj|ri2}}
* {{para|adj|ri3}}
Note that there is no {{para|adj|ri-1}}{{nay}} or similar for rounding above the decimal place. Neither is there support for significant figures, multiples of 5, or any other output-rounding feature.
The default precision is computed based on the input, so an explicit output precision must usually be supplied:
* {{tlc|convert|4.14159|mi|km|adj{{=}}ri0}} → {{convert|4.14159|mi|km|adj=ri0}} {{nay}} (precisions are mismatched)
* {{tlc|convert|4.14159|mi|km|0|adj{{=}}ri0}} → {{convert|4.14159|mi|km|0|adj=ri0}} {{aye}}
In this case, if the input were rounded before conversion, a different result would be obtained:
* {{tlc|convert|<nowiki>{{#expr:4.14159 round 0}}</nowiki>|mi|km|0}} → {{convert|{{#expr:4.14159 round 0}}|mi|km|0}} {{nay}} (double rounding)
==Into multiple units: ''{{convert|10|C|F K}}''==
Линија 138 ⟶ 190:
See also:
* For multiple-unit options like ''1 ft 5 in'', see
==Ranges of values==
Линија 157 ⟶ 209:
In science, the formal way is to set <code>|x|</code> and {{para|abbr|on}} (keeping dimensions right, like in ''area = x km<sup>2</sup>''):
* <code><nowiki>{{convert|6|x|12|m|ft|abbr=on}}</nowiki></code> → {{convert|6|x|12|m|ft|abbr=on}}
===Lists of values: ''20, 40, or 60 miles''===
:<code><nowiki>{{convert|20|,|40|, or|60|mi}}</nowiki></code> → {{convert|20|,|40|, or|60|mi}}
===About ''feet, inch'' in ranges and multiples===
While it is possible to enter feet, inch in a simple conversion, this is not possible for ranges:
* <code><nowiki>{{convert|1|ft|3|in|x|3|ft|5|in|mm}}</nowiki></code> → {{convert|1|ft|3|in|x|3|ft|5|in|mm}} {{nay}}
Default behaviour, for comparison:
* <code><nowiki>{{convert|1|ft|3|in|mm}}</nowiki></code> → {{convert|1|ft|3|in|mm}}
Линија 170 ⟶ 225:
:<code><nowiki>{{convert|1|m|ft|sp=us}}</nowiki></code> → {{convert|1|m|ft|sp=us}}
===<span id="spell"></span>Spell out numbers: ''ten miles''===
To write a number in words, use {{para|spell|in}}:
* <code><nowiki>{{convert|10|mi|m|spell=in}}</nowiki></code> → {{convert|10|mi|m|spell=in}}
Линија 191 ⟶ 246:
===After adjective unit: ''A {{convert|10|ft|ft|adj=mid|-long|disp=out|order=flip}} corridor''===
Note that two units (in this case, ft and m) are required. Use with just one unit will generate an error message.
:<code><nowiki>{{convert|10|ft|m|adj=mid|-long}}</nowiki></code> → {{convert|10|ft|m|adj=mid|-long}}
Линија 205 ⟶ 261:
===Fractions: ''one-eighth of an imperial pint''===
The convert template also supports spelling out fractions.
* <code><nowiki>{{convert|3+1/
Any additional words needed for the fraction can also be added at the end of the template.
* <code><nowiki>{{convert|1/8|imppt|
<!-- todo: decimals & negative examples -->
===Wrapping and line breaking===
:See {{section link|Help:Convert|Wrapping and line breaking}}
===<span id="million"></span>Spelling out "thousands", "millions", etc.===
Most unit codes accept a prefix of e3 (thousand) or e6 (million) or e9 (billion).
* <code><nowiki>{{convert|100|e6mi|e6km}}</nowiki></code> → {{convert|100|e6mi|e6km}}
* <code><nowiki>{{convert|120|e6acre}}</nowiki></code> → {{convert|120|e6acre}}
* <code><nowiki>{{convert|120|e6acre|e3km2}}</nowiki></code> → {{convert|120|e6acre|e3km2}}
To display both input and output in scientific notation, use {{para|abbr|on}}
* <code><nowiki>{{convert|100|e6mi|e6km|abbr=on}}</nowiki></code> → {{convert|100|e6mi|e6km|abbr=on}}
To spell out "thousands", "millions", etc., {{para|abbr|unit}} abbreviates the unit; {{para|abbr|off}} displays both full unit names.
* <code><nowiki>{{convert|100|e6mi|e6km|abbr=unit}}</nowiki></code> → {{convert|100|e6mi|e6km|abbr=unit}}
* <code><nowiki>{{convert|100|e6mi|e6km|abbr=off}}</nowiki></code> → {{convert|100|e6mi|e6km|abbr=off}}
==Numbers==
===Using an SI prefix: ''gigameter (Gm)'', or ''micrometer (
{{Sidebar metric prefixes (small)}}
Units can have an [[metric prefix|SI prefix]] like <code>G</code> before the unit: <code>Gm</code>, and <code>giga</code> before the name: <code>gigameter</code>. These are plain multiplication factors.
Линија 225 ⟶ 297:
* <code>km</code>: {{convert|12|km|ft|abbr=on}}
* <code>mm</code>: {{convert|12|mm|in|abbr=on}}
* <code>
* <code>um</code>: {{convert|12|um|mm|abbr=on}} (letter "u" can be used for "
The prefix can be used in the output unit:
Линија 232 ⟶ 304:
* <code><nowiki>{{convert|12|in|μm|abbr=on}}</nowiki></code> → {{convert|12|in|μm|abbr=on}}
As an exception, the non-SI unit "inch" can have the "
* <code><nowiki>{{convert|12|
{{further information|Help:Convert units#SI prefixes}}
Линија 240 ⟶ 312:
====In the unit: ''e6m''====
[[Engineering notation
* <code><nowiki>{{convert|
The same is possible for the output unit:
Линија 253 ⟶ 325:
* <code>e15</code> (quadrillion).
===Scientific notation: ''1.
In [[scientific notation]], a number is written like {{rnd|12.3e-15|16}}. The plain number has exactly one digit before the decimal point.
Линија 265 ⟶ 337:
*<code><nowiki>{{convert|1⁄2|in|mm|1}}</nowiki></code> → {{convert|1⁄2|in|mm|1}}
With
*<code><nowiki>{{convert|2+1⁄2|in|mm|1}}</nowiki></code> → {{convert|2+1⁄2|in|mm|1}}
*<code><nowiki>{{convert|-2-1⁄2|in|mm|1}}</nowiki></code> → {{convert|-2-1⁄2|in|mm|1}}
Note that the following cases are not interpreted as mixed numbers:
*<code><nowiki>{{convert|2-1⁄2|in|mm|1}}</nowiki></code> → {{convert|2-1⁄2|in|mm|1}}. This is interpreted as a range from 2 inches to 1⁄2 inch.
*<code><nowiki>{{convert|-2+1⁄2|in|mm|1}}</nowiki></code> → {{convert|-2+1⁄2|in|mm|1}} {{nay}} This is neither a mixed number nor a range, and mathematical expressions requiring calculations are not allowed here.
===Output with horizontal fraction bar in: ''{{sfrac|1|2}} inch''===
Линија 293 ⟶ 367:
* <code><nowiki>{{convert|1234567|m|ft}}</nowiki></code> → {{convert|1234567|m|ft}}
Setting {{para|comma|5
* <code><nowiki>{{convert|1234|m|ft|comma=5}}</nowiki></code> → {{convert|1234|m|ft|comma=5}}
* <code><nowiki>{{convert|1234567|m|ft|comma=5}}</nowiki></code> → {{convert|1234567|m|ft|comma=5}}
Default behaviour, for comparison:
* <code><nowiki>{{convert|1234|m|ft}}</nowiki></code> → {{convert|1234|m|ft}}
Линија 314 ⟶ 386:
* <code><nowiki>{{convert|10|m|ft|disp=br}}</nowiki></code> → {{convert|10|m|ft|disp=br}}
Also {{para|disp|br()}} will force a new line, and keep the brackets (useful in tables):
* <code><nowiki>{{convert|10|m|ft|disp=br()}}</nowiki></code> → {{convert|10|m|ft|disp=br()}}
Setting {{para|disp|x{{!}}…}} allows any text as separator:
* <code><nowiki>{{convert|10|m|ft|disp=x|_MyText_}}</nowiki></code> → {{convert|10|m|ft|disp=x|_MyText_}}
<!--todo: works for multiple freetexts too! |disp=x|TextA|TextB -->
===<span id="flip"></span>Flipping (reordering) the two measurements: ''{{convert|1|mi|m|order=flip|sigfig=5|abbr=off}}'' ===
Setting {{para|order|flip}} will flip (swap) the two measurements:
* <code><nowiki>{{convert|1|mi|m|order=flip}}</nowiki></code> → {{convert|1|mi|m|order=flip|sigfig=5|abbr=off}}<!-- Extra settings added to enhance the illustration. Don't know if this is ideal way of documenting. DePiep, August 2014. --
Default behaviour, for comparison:
* <code><nowiki>{{convert|1|mi|m}}</nowiki></code> → {{convert|1|mi|m|sigfig=5|abbr=off}}
Линија 329 ⟶ 402:
* <code><nowiki>{{convert|10|km|mi nmi|order=flip}}</nowiki></code> → {{convert|10|km|mi nmi|order=flip|sigfig=5|abbr=off}}
* <code><nowiki>{{convert|10|km|nmi mi|order=flip}}</nowiki></code> → {{convert|10|km|nmi mi|order=flip|sigfig=5|abbr=off}}
===Fixed ordering of output units: ''{{convert|100|C|F C K|abbr=on|order=out}}'' ===
Setting {{para|order|out}} shows the output-units as ordered; the input unit is skipped:
*<code><nowiki>{{convert|100|C|F C K|abbr=on|order=out}}</nowiki></code> → {{convert|100|C|F C K|abbr=on|order=out}}
*<code><nowiki>{{convert|200|PS|kW hp|0|abbr=on|order=out}}</nowiki></code> → {{convert|200|PS|kW hp|0|abbr=on|order=out}}
''See also: [[Template:Convert#Displaying_parts_of_the_result:_2_(1.5)|§ Displaying parts of the output]]''.
=== Displaying parts of the result: ''{{convert|2|cuyd|m3|abbr=values}}''===
Линија 335 ⟶ 415:
{| class="wikitable"
! Convert !! Output !!
|-
| <code><nowiki>{{convert|2|cuyd|m3}}</nowiki></code> || {{convert|2|cuyd|m3}}
|
|-
| <code><nowiki>{{convert|2|cuyd|m3|abbr=values}}</nowiki></code>
Линија 349 ⟶ 429:
| Input unit, adjective (hyphenated)
|-
| <code><nowiki>{{convert|2|cuyd|cuyd
|-
| <code><nowiki>{{convert|2|cuyd|m3|abbr=~}}</nowiki></code> || {{convert|2|cuyd|m3|abbr=~}}
Линија 362 ⟶ 442:
|-
| <code><nowiki>{{convert|2|cuyd|m3|disp=out}}</nowiki></code> || {{convert|2|cuyd|m3|disp=out}}
| Output value and unit name
|-
| <code><nowiki>{{convert|2|cuyd|m3|disp=out|abbr=off}}</nowiki></code> || {{convert|2|cuyd|m3|disp=out|abbr=off}}
| Output value and unit symbol
|}
Линија 393 ⟶ 473:
{{para|disp|tablecen}} does the same, and also centers the text:
:<code><nowiki>{{convert|20|m|ft|disp=tablecen}}</nowiki></code> →
::<code>{{convert|20|m|ft|disp=tablecen}}</code>
Линија 414 ⟶ 494:
===Sorting===
Use {{para|sortable|on}} to include a ''hidden numerical sortkey'' in the output, suitable for use in a [[Help:Sorting|table with sortable columns]]. Technically, this places a hidden string before the actual displayed values:
:<code><nowiki>{{convert|10|m|ft|sortable=on}}</nowiki></code> {{nowrap|1=→ <code><span style="display:none"
:showing: {{convert|10|m|ft|sortable=on}}.
Use both {{para|disp|table}} and {{para|sortable|on}} together to produce table columns (pipe symbols) for each value in sortable columns:
Линија 439 ⟶ 520:
==Units==
The conversion factors and physical constants are sourced [[Module:Convert/documentation/conversion data introduction/doc#Conversion factors and physical constants|here]].
===All units===
{{selfref|See also: [[Template:Convert/list of units|Convert/list of units]]}}
Линија 446 ⟶ 529:
</div>
==={{anchor|per}}'per' units: ''kg/hl'', ''miles per gallon''===
When using a slash (<code>/</code>), a unit like <code>kg/hl</code> is recognized as kilograms ''per'' hectolitre and will be converted with other mass/volume units.
* <code><nowiki>{{convert|1000|kg/hl}}</nowiki></code> → {{convert|1000|kg/hl}}
Population density (''inhabitants per square mile'') can be converted using
* <code><nowiki>{{convert|10|PD/sqmi|PD/sqkm}}</nowiki></code> → {{convert|10|PD/sqmi|PD/sqkm}}
Vehicular fuel efficiency, commonly expressed in ''miles per gallon'' or ''litres per 100 km'' can also be converted
* <code><nowiki>{{convert|26|mpgUS|l/100km mpgimp}}</nowiki></code> → {{convert|26|mpgUS|l/100km mpgimp}}
==={{anchor|Units of difference}}Units of difference: Expressing a change or difference in temperature===
We have already discussed standard temperature conversions (°C, °F, K), as shown in these two examples:
* {{#invoke:DemoTemplate|convert|10|C}} (standard temperature conversion)
* {{#invoke:DemoTemplate|convert|10–15|C}} (standard temperature range conversion)
When expressing a temperature ''change'' (e.g., "The temperature ''increased'' by 10 °C"), or when ''comparing'' temperatures (e.g., "10 to 15 °C ''warmer''"), we cannot use the standard temperature units ({{para||C}}, {{para||F}} and {{para||K}}), which refer to points on the respective scale. Instead, we must use one of the following "units of difference": {{para||C-change}}, {{para||F-change}} and {{para||K-change}}.
Compare the following two examples with the two above:
* {{#invoke:DemoTemplate|convert|10|C-change}} increase in temperature
* {{#invoke:DemoTemplate|convert|
*
===Multiple units: ''1 ft 5 in''===
Линија 483 ⟶ 576:
Using currency symbols in a ''$ per unit'' value, you can convert the per-unit:
* <code><nowiki>{{convert|10|$/mi|$/km}}</nowiki></code> → {{convert|10|$/mi|$/km}}
* <code><nowiki>{{convert|1500|$/ozt|$/g}}</nowiki></code> → {{convert|1500|$/ozt|$/g}}
You can set the currency in ''both'' values using {{para|$|€}}:
Линија 488 ⟶ 582:
It is ''not'' possible to convert the currency. So, this result (mixed currencies) is ''not'' possible: {{!mxt|1=$15 per mile (€8.6/km)}} {{nay}}
==Using convert inside templates==
For usage in template code, like infoboxes, {{tlf|Convert}} has these options:
;Pre-formatting fraction input
* [[Module:Convert/helper]] can read regular input and pre-format it into {{tlf|Convert}}-accepted input.
:Your template can accept {{para|input|16 7/8}} and use <nowiki>{{#invoke:Convert/helper|number|16 7/8}}</nowiki> → {{#invoke:Convert/helper|number|16 7/8}}
;Using a Wikidata property
* Adding the Wikidata property code, like code {{para|input|P2073}}, to your template code automatically returns the Wikidata property for that article, and convert it. Both number and unit are read.
Note: to return that property value for an ''other'' article, use {{para|qid}}.
Example for {{Wikidata property link|P2073}}:
Note: this example uses {{para|qid|Q1056131}} (testing for {{Wikidata entity link|Q1056131}})
* <code><nowiki>{{convert|input=P2073|qid=Q1056131|ftin|abbr=on}}</nowiki></code> → {{convert|input=P2073|qid=Q1056131|ftin|abbr=on}}
* <code><nowiki>{{convert|input=P2073|qid=Q1056131|km|abbr=on}}</nowiki></code> → {{convert|input=P2073|qid=Q1056131|km|abbr=on}}
* <code><nowiki>{{convert|input=P2073|qid=Q1056131|km|abbr=on|disp=out}}</nowiki></code> → {{convert|input=P2073|qid=Q1056131|km|abbr=on|disp=out}}
:For example see [[template:Infobox Telescope]].
==Parameter list==
Линија 500 ⟶ 611:
<templatedata>
{
"description": "
"params": {
"1": {
"label": "
"description": "
"type": "number",
"
},
"2": {
"label": "
"description": "
"type": "string/line",
"example": "km",
"required": true
},
"3": {
"label": "
"description": "The units to convert into. Separate units by a space for multiple outputs. In an output unit, use + for a multiplication space.",
"type": "string",
"
"suggested": true
},
"4": {
"label": "
"description": "
"type": "number"
},
"lk": {
"label": "
"description": "Indication of what units to apply wikilinks to. Use “on” for all, “in” for the input unit, “out” for the output units, or “off”
"default": "off",
"type": "string
"example": "on"
},
"abbr": {
"label": "
"description": "
"default": "out",
"type": "string
"example": "on, unit, in, out, off",
"suggested": true
},
"sp": {
"label": "
"description": "Spelling of units. Use “us” to display unit names using U.S. spelling
"type": "string
"example": "us"
},
"adj": {
"label": "
"description": "
"type": "
"example": "on",
"default": "off"
},
"disp": {
"label": "
"description": "
"
"
"deprecated": "use order=flip instead"
},
"order": {
"label": "
"description": "“flip” returns converted value first, input value second.",
"type": "string
"example": "flip"
},
"sigfig": {
"label": "
"description": "
"type": "number"
},
"round": {
"label": "
"description": "The type of rounding. “5” rounds the output number to nearest multiple of 5, “25” to nearest multiple of 25, “each” rounds each number in a range.",
"type": "
},
"comma": {
"label": "
"description": "Sets or suppresses
"default": "on",
"type": "string
"example": "off"
},
"sortable": {
"label": "
"description": "“on” generates a hidden sort key",
"type": "string
"example": "on"
},
"spell": {
"label": "spell numbers?",
"description": "If used, spells input or input and output numbers in words, optionally capitalizing the first",
"example": "'in', 'In', 'on', or 'On'",
"type": "string"
},
"sing": {
"type": "string",
"deprecated": "use adj=",
"label": "singular",
"description": "If 'yes', uses singular form of units (deprecated)",
"example": "yes"
},
"frac": {
"label": "fraction",
"description": "fraction as rounding unit",
"type": "number"
},
"$": {
"label": "currency symbol",
"description": "sets currency symbol in both units",
"example": "$=€ will show \" €10 per mile (€6.2/km)\"",
"type": "string"
},
"input": {
"label": "WD property",
"description": "Reeds the property value of the item (article), then converts it",
"example": "{{convert|input=P2046}} (P2046=area)",
"type": "string"
}
},
"format": "inline"
}
</templatedata>
Линија 612 ⟶ 750:
<noinclude>
[[Category:Convert by module documentation| ]]
</noinclude><includeonly>{{#ifeq:{{SUBPAGENAME}}|
[[Category:Convert templates| ]]
[[Category:Conversion templates]]
|