Шаблон:Convert/basic/doc
Purpose
вироишOriginally template {{convert}} used a complex system of {{#switch
}}s all fitting on one page. Let's call this version of the template Convert I.
Convert I was quite limited in terms of functionality and units covered. Users requested more but the problem with {{#switch
}}s is that they eat up the template limits. More units would mean bigger {{#switch
}}s and thus a slower template. {{ConvertW}} and {{convertV}} were created in Convert I's image to convert mass and volume respectively. Meanwhile work was being done on an alternative design.
In November 2007 Convert I was replaced with a new version, let's call it Convert II. The {{#switch
}}s were replaced with subpages. This subpage design has allowed for an enormous increase in the functionality and capacity of the template. It now handles hundreds of units and is capable of several ways of presenting the conversions.
Of course this comes at a cost. Convert I's single page is replaced by thousands of Convert II pages (yes, thousands). Many of these were added ad hoc over the years as new requests flowed in. The template has become somewhat difficult to work on. It's full of quirks, twists and knobbles. It could do with another overhaul. We now can make use of calculations not possible 2007 also we have different template limits to consider.
Convert III is in the works; it is, however, no easy task to rewrite a template like this. So, what do you do if you want to transwiki this template? You could wait for Convert III, you could get started on Convert II or you could even try your luck with Convert I. Before doing any of these why not have a look at {{convert/basic}} (this version)?
{{Convert/basic}} is based on the coding of Convert I in that it uses {{#switch
}}s. The functionality and capacity of {{convert/basic}} is a little better than Convert I (but still nowhere close to that of Convert II). The advantage is that you only have to transwiki a few templates. Use this until Convert III is working, use it whilst you're in the middle of transwikiing Convert II or, if a basic version is all you need, just use it (instead of Convert I).
- Subpages
- Template:Convert/basic (edit | talk | history | links | watch | logs)
- Template:Convert/basic/doc (edit | talk | history | links | watch | logs)
- Template:Convert/basic/calc (edit | talk | history | links | watch | logs)
- Template:Convert/basic/factor (edit | talk | history | links | watch | logs)
- Template:Convert/basic/or (edit | talk | history | links | watch | logs)
- Template:Convert/basic/paren (edit | talk | history | links | watch | logs)
- Template:Convert/basic/table (edit | talk | history | links | watch | logs)
- Template:Convert/basic/outunit (edit | talk | history | links | watch | logs)
- Template:Convert/basic/valdisp (edit | talk | history | links | watch | logs)
- Template:Convert/basic/abbr (edit | talk | history | links | watch | logs)
- Template:Convert/basic/article (edit | talk | history | links | watch | logs)
- Template:Convert/basic/name (edit | talk | history | links | watch | logs)
- Auxiliary
- Template:Max (edit | talk | history | links | watch | logs)
- Template:Order of magnitude (edit | talk | history | links | watch | logs)
- Template:Precision (edit | talk | history | links | watch | logs)
- Units
length | area | volume | speed | mass | temperature | |
---|---|---|---|---|---|---|
metric |
|
|
|
|
|
|
imperial/US |
|
|
|
|
|
|
other |
|
|
|
- Parameters
3
|
The convert-to unit is optional. |
---|---|
4
|
The rounding is optional. |
lk
|
off (default), on , in or out
|
abbr
|
def (default), off , on , in or out
|
disp
|
paren (default), or or table
|
adj
|
off (default) or on
|
Test cases
вироиш- 12 metres (13 yd)
- 1 kilogram (2,2 lb)
- 355 milliliters (12 US fl oz)
- 12 kn (22 km/h)
- 12 knots (6,2 m/s)
- 100 miles per hour (160 km/h)
- 100 cubic feet (2,8 m3)
- 5 miles (8 km)
- 100 cubic feet (2,8 cubic metres)
- 100 feet per second or 30 metres per second
- 100 °C (212 °F)
- 10 degrees Fahrenheit (−12 °C)
1 234 | 1,2 |
11 | 52 |