Wikipedia:Advanced Convert coding

From Wikipedia, the free encyclopedia
  (Redirected from Wikipedia:ACONVERT)
Jump to: navigation, search

Wikipedia:Advanced Convert coding describes some techniques to improve or expand the use of the Wikipedia unit-converter, Template:Convert. Most of the tips involve setting the parameters.

Some techniques here are beyond the basics described in the Convert docpage ("{{Convert/doc}}") which explains almost all basic options of the parameters, also showing examples of each. The currently supported units are listed under {{Convert/list of units}}. Several options presented here have been discussed, months ago, in the talk-page, Template_talk:Convert.

Option disp=x to customize output separators[edit]

15-Aug-2010: Using option "disp=x" (such as "disp=x| << | >>") will insert custom text/separators around the output amount (option added: August 2010). Here are some live examples:

  • {convert|5|mi|km|disp=x| [ | ] } → 5 miles [ 8.0 km ]
  • {convert|5|mi|km|disp=x|; } → 5 miles; 8.0 km
  • {convert|88|m|ft|disp=x| {equals |} } → 88 metres {equals 289 ft}
  • {convert|3|sqmi|km2|disp=x| (equals |, others likewise) } → 3 square miles (equals 7.8 km2, others likewise)
  • {convert|9|ft|cm|disp=x| (same as |)} → 9 feet (same as 270 cm)

Any spaces in those parameters will appear in the output. This option disp=x will allow editors to vary the wording, to avoid monotonous repetitions, and perhaps combine live conversions with other hand-coded numbers as the customized text.

More subtemplates have been created to allow the option disp=x to work in ranges or non-abbreviated units. The concept of customizing the output format has been considered for years, but the former stumbling block had been the end-round parameter "|1" which is treated here as parameter 6 when disp=x, and that allows customization to proceed. I have been studying this issue for years, so I don't foresee any major complications, for general usage of disp=x. However, more unit-subtemplates will need to be updated to pass parameters 5/6/7 so that the ending text can be specified for any unit, not just for miles, feet, or metres. Also, we might be able to replace disp=s using disp=x and reduce perhaps a few hundred other subtemplates that are not used very much, as being deprecated, in favor of using disp=x. Note that a semicolon can be specified by "disp=x|; " to separate by semicolon.[1]

Other abbreviation options: abbr=in or abbr=out[edit]

29-Oct-09: There are options now to control the input versus the output-abbreviations (similar to linking as options lk=in or lk=out). There are 5 settings for abbreviation to show unit symbols:

  • abbr=off, abbr=on, abbr=in, abbr=out & abbr=none.

This is the first time it has been possible to abbreviate just the input units, using abbr=in, and leave full-word form as the output: such as "xx km (xx miles)":

{{convert|16|cm|in|abbr=in}}   gives: 16 cm (6.3 inches)
{{convert|4|kg|lb|abbr=in}}       gives: 4 kg (8.8 pounds)
{{convert|6|ft|3|in|cm}}                 gives: 6 feet 3 inches (191 cm)
{{convert|6|ft|7|in|cm|abbr=in}}      gives: 6 ft 7 in (201 centimetres)

For many conversions, the default has been "abbr=out" so that the km/mi conversions have stated "xx kilometres (xx mi)". The other options (in/out) were added for completeness, to allow anything: in, out, both or none. However, the logical preference seems to be abbr=in, because for most articles where the culture is metric, then "km" would be obvious, but other readers might wonder about "mi". The use of abbr=in gives "xx km (xx miles)" and also avoids the end-spelling of -metre/meter which has been irritating to some readers.

Rounding the output amounts[edit]

When invoking {{convert}}, the end-parameter can be a number to designate the level of rounding, such as "0" for whole numbers, "1" for 1 decimal (tenths), "2" for 2 decimals, "-2" for whole hundreds 100's, etc. For example:

  • {{convert|741|ft |0}}   gives: 741 feet (226 m)
  • {{convert|741|ft |1}}   gives: 741 feet (225.9 m)
  • {{convert|741|ft |2}}   gives: 741 feet (225.86 m)
  • {{convert|741|ft |-2}}  gives: 741 feet (200 m)

The use of the rounding-parameter can be altered by using sigfig=3 (or similar) to control the precision of the output amounts.

Surrounding conversions to round by 5 or 25[edit]

07-Jan-2011: In some instances, a converted result should be rounded to the nearest 5 units, rather than the nearest 1 unit. The option "disp=5" causes results to be rounded to the nearest 5 units. The algorithm is:  round by 5 = (n/5 round 0) * 5. For example, in metres-to-feet:

  • Consider precise amounts:  80.0 metres (262.467 ft) and 93.0 metres (305.118 ft)
  • For 80 m rounded to nearest 5 ft, {{convert|80|m|ft|3|disp=5}} → 80 metres (262.467 ft)
  • For 93 m rounded to nearest 5 ft, {{convert|93|m|ft|3|disp=5}} → 93 metres (305.118 ft)

Only disp=5 is supported, due to "5" being a common limit. However, to round to other amounts, use the following method with option disp=number:

  • Round 93 m to nearest 25 ft, {{#expr:({{convert|93|m|ft|3|disp=number}}/25 round0)*25}} → 300 ft

In general, for any number rounded to the nearest 'n':

  • Rounding 13.11 by 5: {{#expr: (13.11 / 5 round 0) * 5}} gives: 15
  • Rounding 19.44 by 6: {{#expr: (19.44 / 6 round 0) * 6}} gives: 18
  • Rounding 32.48 by 15: {{#expr: (32.48 / 15 round 0) * 15}} gives: 30
  • Rounding 82.6 by 25: {{#expr: (82.6 / 25 round 0) * 25}} gives: 75

Larger numbers will require removing commas by {{formatnum: 1,234|R}}:

  • Round 967 m to nearest 20 ft:  {{#expr:({{formatnum: {{convert|967|m|ft|3|disp=number}}|R}}/20 round 0)*20}} for: 3180 ft

Although the need to round by 6's or 25's is rare, similar coding can be used to adjust the results in other ways.

Customizing the results for output-only[edit]

The template {{convert}} has parameters to alter the display-format, such as abbr=on to abbreviate all units. However, there might be a need for a customized display, beyond the formats offered as parameters. For maximum customization, use the options to show only the results:

  • disp=out -  display only the results with units (or: disp=output only)
  • disp=number -  display only the resulting numbers (no units)

By using those options, all the surrounding text can be customized, with any words or wikilinks, as needed. For example, use:

Single values:
  • {{convert|742|ft |disp=out}}          gives: 226 m
  • {{convert|747|ft |disp=out}}          gives: 228 m
  • {{convert|742|ft |disp=number}}   gives: 226
  • {{convert|742|to|747|ft |disp=or}}        gives: 742 to 747 feet or 226 to 228 metres
  • {{convert|742|to|747|ft |disp=out}}      gives: 226 to 228 m
  • {{convert|28|to|31|C |F |disp=out}}      gives: 82 to 88 °F

Then, the surrounding text can be any wording:

"a 28-to-31 °C temperature range (equivalent 82 to 88 °F) is possible"

With that customization, any extra words can be inserted, such as "equivalent" or "range" or "temperature" (etc.) to surround the result (of "82 to 88 °F").

Displaying result first by disp=flip[edit]

10-Nov-2009: The display option disp=flip can be used to flip the result, reversed as first in order:

  • {{convert|36|ft|6|in |m|abbr=on|disp=flip}}      gives: 11.13 m (36 ft 6 in)
  • {{convert|12|lb|8|oz |kg|abbr=on|disp=flip}}   gives: 5.7 kg (12 lb 8 oz)
  • {{convert|10|m|ft|abbr=on|disp=flip}}   gives: 33 ft (10 m)
  • {{convert|10|-|15|m|ft|abbr=on|disp=flip}}   gives: 33–49 ft (10–15 m)
  • {{convert|10|m|ft|disp=flip5}}   gives: 35 feet (10 m)

So, the option "disp=flip" will flip and reverse the order of the output, inverting the result as first in the text and the input unit as last (in reverse order). Special option "disp=flip5" can both flip and round the left-side amount to the nearest 5 units. To abbreviate as with typical unit symbols, then use "abbr=in" to abbreviate the left-hand (input) side of the results.

Displaying unit name by disp=unit[edit]

The display type disp=unit will display just the unit name (as singular, plural or hyphenated) for an input-unit symbol:

  • {{convert|1 |ft|disp=unit}}           gives: foot
  • {{convert|9 |ft|disp=unit}}           gives: feet
  • {{convert|7 |m3|disp=unit|abbr=on}}       gives: m3
  • {{convert|7 |m3|disp=unit|abbr=off}}       gives: cubic metres
  • {{convert|1 |cuyd|disp=unit|lk=on}}       gives: cubic yard
  • {{convert|1 |cuyd|disp=unit|adj=on}}      gives: cubic-yard

The option disp=unit can also be used, during article writing, as a means to display a unit name or symbol for a specific unit-code when writing an article.

Template:Convert/3 for cubic or 3 amounts[edit]

06-Nov-2009: The subtemplate Template:Convert/3, for 3-amount conversions, allows any mixture of "to" or "by" or "x" or "-" or "and" (etc.) as the range-words; plus the separator can also be a semicolon, using disp=semi:

  • {{convert/3 |5|by|6|by|7|m|ft}}     gives: 5 by 6 by 7 metres (16 by 20 by 23 ft)
  • {{convert/3 |5|x|6|x|7|m|ft}}        gives: 5 × 6 × 7 metres (16 × 20 × 23 ft)
  • {{convert/3 |7|to|8|to|9|km|mi|abbr=on}}    gives: 7 to 8 to 9 km (4.3 to 5.0 to 5.6 mi)
  • {{convert/3 |7|to|8|to|9|km|mi|adj=on}}      gives: 7-to-8-to-9-kilometre (4.3-to-5.0-to-5.6 mi)
  • {{convert/3 |5|to|6|by|7|m|ft}}     gives: 5 to 6 by 7 metres (16 to 20 by 23 ft)
  • {{convert/3 |5|by|6|x|7|m|ft}}      gives: 5 by 6 × 7 metres (16 by 20 × 23 ft)
  • {{convert/3 |11|-|22|-|33|°C|F|disp=semi|lk=on}}     gives: 11–22–33 °C; 52–72–91 °F

The input units (like "metre") can be abbreviated or linked, using parameters abbr=in, abbr=on, lk=on or lk=in.

Option disp=preunit allows "+" before units[edit]

24-May-2012: The option "disp=preunit" (which displays pre-text before each unit name or symbol) also allows placing a "+" after a numeric amount. In general, the first preunit text is displayed from parameter 4, and the 2nd pre-unit text from parameter 5 (else repeats text from parameter 4).

  • {{convert|4|m|ft|disp=preunit|+ }} → 4+ metres (13+ ft)
  • {{convert|4|m|ft|disp=preunit|+ | or more }} → 4+ metres (13 or more ft)
  • {{convert|9|m|ft|disp=preunit|+ |+ |1}} → 9+ metres (29.5+ ft)
  • {{convert|40|kg|lb|disp=preunit|exact | |3}} → 40 exact kilograms (88.185 exact lb)
  • {{convert|40|kg|lb|disp=preunit|exact |&#32;|3}} → 40 exact kilograms (88.185 lb)

Note that leaving parameter 5 as blank will repeat the preunit text from parameter 4, and allow parameter 6 to set the rounding (here, as 3 decimal digits). To omit the 2nd preunit text, then code parameter 5 as a Unicode space character, "&#32;".

If parameter 4 is a plus sign ("+"), then no space is inserted before the plus sign.

Convert/date gives ISO date or day for: date[edit]

08-Nov-2009: The unit name "date" triggers the new (huge) subtemplate {{Convert/date}} to convert a date into ISO format or the day-of-the-year (1 to 366):

That template was purposely designed (to be gigantic) to show that Wikipedia's MediaWiki preprocessor can handle at least 2,928 switch-branches in a single subtemplate, plus internal documentation and category-links. See page: Template:Convert/date.

Convert/wrench handles spanner wrench sizes[edit]

31-Oct-2009: Another smart-conversion template, as {{Convert/wrench}} or {{Convert/spanner}}, can display the related wrench (spanner) sizes. For sizes that don't quite fit, it displays the term "(loose 3/4)" or "(loose 1/8)" (etc.) because sometimes, bolts have odd sizes (or outer deposits) that allow a loose wrench to fit. Some examples:

The template lists from 1-26mm so far, in #switch-blocks, but allows adding other official sizes. (When the size is 1mm less, it displays "loose 17/16" etc.) It handles most common sizes, putting 26mm as a "1-inch" size. Anyway, Template:Convert/wrench is another example of the next-generation smart templates.

Convert/note gives pitch for piano key: note[edit]

08-Nov-2009: The unit name "note" triggers the new subtemplate {{Convert/note}} to convert a piano key note-name into the equivalent pitch (frequency) in hertz:

That template was developed to also demonstrate the use of non-numeric conversions, converting a name into a musical pitch (frequency). See page: Template:Convert/note.

Plan to reduce subtemplates[edit]

08-Nov-2009: It is becoming far more difficult to implement new options, as the number of Convert-subtemplates grows by hundreds each time. Recently, over 650 new subtemplates were added, but we should prepare to reduce those in the next few months. See essay: "Wikipedia:A plan to reduce Convert subtemplates". It would be easier to control commas by: comma=off, comma=in, comma=out, comma=on. Plus, some people want to round the input amount, such as round=in, round=out (current default), or round=on. Unless the current design is condensed, those new options could require modifying hundreds of subtemplates.

Categories for recent Convert subtemplates[edit]

Before October 2009, the talk-page Template_talk:Convert had been the only notice of new Convert subtemplates. However, there are categories for listing new subtemplates:

There is a separate category for each year of the newer subtemplates. Insert the category-link at the bottom of new templates.

Defining new conversion subtemplates[edit]

Just like with creating new article-pages, users are allowed to create new unit-conversion subtemplates. Each unit subtemplate invokes "{{convert/{{{d}}}|...}}" but can be tested by invoking "convert/LoffAoffDbSoff" instead, to show calculation results in an edit-preview. For example, someone might want to create a "kilograms-per-centimetre" (kg/cm) as a variation of the typical kg-per-metre conversion "kg/m", by copying "Template:Convert/kg/m" as new name "Template:Convert/kg/cm" and altering the contents, as described below.

For a more complex example, see below:  #Defining complex subtemplates.
ORIGINAL - Template:Convert/kg/m
| r={{{r}}}
| u=kg/m
| n=kilogram per met{{{r}}}
| h=kilogram-per-met{{{r}}}
| l=kilograms per met{{{r}}}
| t=linear density
| o=lb/yd
| b=1
| j=0-{{{j|0}}}<!--end-->}}

The new subtemplate would be named "Template:Convert/kg/cm" with the coding copied and altered from viewing the template {{Convert/kg/m}}:

COPIED - Template:Convert/kg/cm
| r={{{r}}}
| u=kg/cm
| n=kilogram per centimet{{{r}}}
| h=kilogram-per-centimet{{{r}}}
| l=kilograms per centimet{{{r}}}
| t=linear density
| o=lb/yd
| b=100
| j=0-{{{j|0}}}<!--end-->}}

Note that the new conversion factor is b=100, as the multiplier from kg/m to kg/cm, based on 1 m = 100 cm.  The top line, as "{{convert/{{{d}}}|...}}" can be changed to invoke "convert/LoffAoffDbSoff" instead, with a value such as "14" in {{{1|14}}} and {{{3|kg/m}}}, to show results during an edit-preview. When editing a conversion-subtemplate, be very careful to match the exact nesting of braces (pairing the "{{{ }}}"); otherwise, the parameters might be treated as literal text and listed across the page instead (such as string of "...| t=linear density | o=lb/yd | b=100...").

The numbered parameters, {{{1}}}, {{{2}}}, {{{3}}}, ... {{{7}}}, are the first 7 positional parameters passed from using: {{convert|{1}|{2}|{3}|{4}|{5}|{6}|{7}|...}}.

The other parameters are:

  • u = unit symbol, n = unit name, l = plural unit name (lowercase L),
  • h = hyphenated name (singular, such as: mile-per-gallon)
  • t = text linked (such as article "Miles per gallon" for "mpg")
  • b = conversion factor relative to base units (base = 1 m)
  • j = conversion-precision (putting "5" shows result as 5 digits)
  • s = combined rounding for sigfig=x plus end-parameter "0" etc.
  • r = end-spelling as either r=er (American) or r=re
  • y = unit-code for 4-part unit names (view: {{Convert/mpgus}})

To experiment with adjusting the values of those parameters, the new template can be changed, during edit-preview, to invoke template "Convert/LoffAoffDbSoff" in the first line, as follows:

TESTING - Template:Convert/kg/cm
| r={{{r|re}}}
| u=kg/cm
| n=kilogram per centimet{{{r|re}}}
| h=kilogram-per-centimet{{{r|re}}}
| l=kilograms per centimet{{{r|re}}}
| t=linear density
| o=lb/yd
| b=100
| j=0-{{{j|0}}}<!--end-->}}

Along with invoking "Convert/LoffAoffDbSoff", the test also passes {{{1}}} as "14" with {{{3}}} as "kg/m" and {{{r}}} as spelling "re" to show a sample conversion, with the result:

  • 14 kilograms per centimetre (1,400 kg/m)

Then experimenting with adjusting the precision, the value of {j} could be reset as j= -3 to give the following during an edit-preview:

  • 14 kilograms per centimetre (1,400.000 kg/m)

With j= -3, the result gains 3 decimal zeroes as "1,400.000" so that is why {j} was originally set to "0" minus the value of {j} from the other conversion unit, as: j=0-{{{j|0}}}. Before saving the edits, be sure to restore the parameters as "convert/{{{d}}}" with {{{1}}}, {{{3}}} and {{{r}}}, plus j=0-{{{j|0}}}. The parameter {d} allows the conversion to be reversed, where "kg/cm" would be the 2nd unit rather than the 1st unit.

Using the new template {{Convert/kg/cm}}, the results would be:

  • {{Convert|9|kg/m|kg/cm}}          gives: 9 kilograms per metre (0.090 kg/cm)
  • {{Convert|4|kg/m|kg/cm}}          gives: 4 kilograms per metre (0.040 kg/cm)
  • {{Convert|7.3|kg/m|kg/cm}}       gives: 7.3 kilograms per metre (0.073 kg/cm)
  • {{Convert|7.4|kg/m|kg/cm|5}}    gives: 7.4 kilograms per metre (0.07400 kg/cm)
  • {{Convert|0.09|kg/cm|kg/m}}          gives: 0.09 kilograms per centimetre (9.0 kg/m)
  • {{Convert|0.15|kg/cm|kg/m}}          gives: 0.15 kilograms per centimetre (15 kg/m)
  • {{Convert|18|kg/cm|kg/m|adj=on}}   gives: 18-kilogram-per-centimetre (1,800 kg/m)

There is no limit to the number of conversion-subtemplates that can be created. Again, when editing, be very careful to match the nested-braces (pairing "{{{" and "}}}"). Each unit-conversion subtemplate is really the coding to invoke another subtemplate (typically invoking {{Convert/LoffAoffDbSoff}} for output), so that is the reason why the pairing of braces is critical. Below is a more complex example, changing the spelling and using a decimal conversion factor.

Defining complex subtemplates[edit]

Some subtemplates of Template:Convert are more complex, than the above example, due to the need for fractional conversion factors, such as b=(0.00378541178). Also, the category links must be set, and the unit names are respelled for American spelling.

ORIGINAL - Template:Convert/USgal/s

|n={{#ifeq:{{{r|re}}}|re|US|U.S.}} gallon per second
|l={{#ifeq:{{{r|re}}}|re|US|U.S.}} gallons per second
|t=US gallons per second

[[Category:Subtemplates of Template Convert]]
[[Category:2012 Convert unit subtemplates]]

In this example, the conversion factor b=(0.00378541178) has been set relative to the standard of m3/s as having factor "b=1". For example, a conversion in Google Search can be run to calculate the conversion factor b, based on the value of 1 m3/s (the value is "1" because "b=1" in Template:Convert/m3/s):

Search:   1 US gallon per second in cubic meters per second
1 (US gallon per second) = 0.00378541178 (cubic meters) per second

So, the conversion factor can be copied from Google, to set b=( 0.00378541178 ).

Next, the precision is set as j = -2-{{{|0}}}, where the value as "-2" refers to the 2 decimal zeroes in 0.00378541178. So, the 2 leading zeroes as "0.00" indicate "-2" for the value in j = -2-{{{|0}}}. If the factor, instead, were b=(0.00005673), then the precision would become j = -4-{{{|0}}} because of the 4 leading decimal zeroes in the numeral "0.00005...".

Handling the American spellings: This example also shows the use of ifeq-structures to set the spelling of the unit names. So, the unit-name text is set by:

| n={{#ifeq:{{{r|re}}}|re|US|U.S.}} gallon per second

The result will show the unit name as "U.S. gallon per second" when option sp=us; otherwise the name will be "US gallon per second" without the dot full stops, different from the American spelling "U.S.".

The categories are the major "Category:Subtemplates of Template Convert" as with all Convert subtemplates, plus a link to "Category:2012 Convert unit subtemplates" for the year 2012, when the subtemplate was created.

So, this more complex example has show the use of a fractional conversion factor, b=(0.00378541178), then setting the precision j= -2... (for the 2 leading decimal zeroes), plus resetting the unit-name spelling with r=re, and setting the 2 bottom category links.

Defining new display-subtemplates[edit]

With the option-name parts of subtemplate naming, an option value could be added to quickly connect to a particular variation subtemplate, but there would be hundreds of total variations. For example, using abbr=xyz, the related custom variations can be coded as more than 800 subtemplates named with option-name part "Axyz". However, in general, when a variation is created, only a few dozen of the possible combinations are implemented, and the remaining hundreds are omitted, as future subtemplates "under construction" to complete the particular option.

For option abbr=xyz, the 800 subtemplates would be named as follows:

  • regular units with "( )": Template:Convert/LoffAxyzDbSoff, /LoffAxyzDbSon, /LonAxyzDbSoff, /LonAxyzDbSon,
    /LinAxyzDbSoff, /LinAxyzDbSon, /LoutAxyzDbSoff, /LoutAxyzDbSon, etc.
  • regular units with slash "/": Template:Convert/LoffAxyzDsSoff, /LoffAxyzDsSon, /LonAxyzDsSoff, /LonAxyzDsSon,
    /LinAxyzDsSoff, /LinAxyzDsSon, /LoutAxyzDsSoff, /LoutAxyzDsSon, etc.
  • regular units with "or": Template:Convert/LoffAxyzDorSoff, /LoffAxyzDorSon, /LonAxyzDorSoff, /LonAxyzDorSon,
    /LinAxyzDorSoff, /LinAxyzDorSon, /LoutAxyzDorSoff, /LoutAxyzDorSon, etc.
(...and 24 similar, with D/, Doutput only...)
  • 2-unit groups with "( )": Template:Convert/LoffAxyzDbSoff2, /LoffAxyzDbSon2, /LonAxyzDbSoff2, /LonAxyzDbSon2,
    /LinAxyzDbSoff2, /LinAxyzDbSon2, /LoutAxyzDbSoff2, /LoutAxyzDbSon2, etc.
  • 2-unit groups with slash "/": Template:Convert/LoffAxyzDsSoff2, /LoffAxyzDsSon2, /LonAxyzDsSoff2, /LonAxyzDsSon2,
    /LinAxyzDsSoff2, /LinAxyzDsSon2, /LoutAxyzDsSoff2, /LoutAxyzDsSon2, etc.
  • 2-unit groups with "or": Template:Convert/LoffAxyzDorSoff2, /LoffAxyzDorSon2, /LonAxyzDorSoff2, /LonAxyzDorSon2,
    /LinAxyzDorSoff2, /LinAxyzDorSon2, /LoutAxyzDorSoff2, /LoutAxyzDorSon2, etc.
(...and 24 similar, with D/, Doutput only...)
  • temperature units with "( )": Template:Convert/LoffAxyzDbSoffT, /LoffAxyzDbSonT, /LonAxyzDbSoffT, /LonAxyzDbSonT,
    /LinAxyzDbSoffT, /LinAxyzDbSonT, /LoutAxyzDbSoffT, /LoutAxyzDbSonT, etc.
  • temperature units with slash "/": Template:Convert/LoffAxyzDsSoffT, /LoffAxyzDsSonT, /LonAxyzDsSoffT, /LonAxyzDsSonT,
    /LinAxyzDsSoffT, /LinAxyzDsSonT, /LoutAxyzDsSoffT, /LoutAxyzDsSonT, etc.
  • temperature units with "or": Template:Convert/LoffAxyzDorSoffT, /LoffAxyzDorSonT, /LonAxyzDorSoffT, /LonAxyzDorSonT,
    /LinAxyzDorSoffT, /LinAxyzDorSonT, /LoutAxyzDorSoffT, /LoutAxyzDorSonT, etc.
(...and 24 similar, with D/, Doutput only...)
  • regular unit-ranges with "( )": Template:Convert/Dual/LoffAxyzDbSoff, /Dual/LoffAxyzDbSon, /Dual/LonAxyzDbSoff,
    /Dual/LonAxyzDbSon, /Dual/LinAxyzDbSoff, /Dual/LinAxyzDbSon,
    /Dual/LoutAxyzDbSoff, /Dual/LoutAxyzDbSon.
(...and 40 similar, with Ds, Dor, D/, Doutput only...)
  • 2-unit-ranges with "( )": Template:Convert/Dual/LoffAxyzDbSoff2, /Dual/LoffAxyzDbSon2, /Dual/LonAxyzDbSoff2,
    /Dual/LonAxyzDbSon2, /Dual/LinAxyzDbSoff2, /Dual/LinAxyzDbSon2,
    /Dual/LoutAxyzDbSoff2, /Dual/LoutAxyzDbSon2.
(...and 40 similar, with Ds, Dor, D/, Doutput only...)
  • temperature unit-ranges with "( )": Template:Convert/Dual/LoffAxyzDbSoffT, /Dual/LoffAxyzDbSonT, /Dual/LonAxyzDbSoffT,
    /Dual/LonAxyzDbSonT, /Dual/LinAxyzDbSoffT, /Dual/LinAxyzDbSonT,
    /Dual/LoutAxyzDbSoffT, /Dual/LoutAxyzDbSonT.
(...and 40 similar, with Ds, Dor, D/, Doutput only...)
  • (...and 100 for 2-unit results, with Ds, Dor, D/,...)
  • (...and 100 for imperial-units, with Ds, Dor, D/,...)
  • (...and 100 for USre-units, with Ds, Dor, D/,...)
  • (...and 100 for USer-units, with Ds, Dor, D/,...)
  • (...and 100 for engineering-units, with Ds, Dor, D/,...)

Due to the vast number of subtemplates, many of the possible combinations are omitted, which could appear as missing templates, someday, when those combinations are selected by a user on a rare occasion.


  1. ^ There seems to be a bug, for some options, where a leading semicolon ";" is being treated as the bolded-header option: a semicolon starting a line is parsed by the MediaWiki markup parser as meaning "treat text after semicolon as a bolded header". Apparently, this bug stems from the MediaWiki pre-formatting of text within an if-expression (such as "{{#if:{{{4|}}}|...}}") to remove leading or trailing spaces within the then/else clauses of the if-logic, even though parameters can pass leading/trailing spaces as long as not within a markup if-expression. Subtemplates should avoid displaying parameter {4} or {5} inside of if-expressions. Note, these issues, about handling spaces, had been carefully decided over 30 years ago by hundreds of computer scientists; however, each generation of people must re-learn the technical gotchas, and such learning seems faster in friendly collaboration with older experts, not likely these days. Anyway, avoiding the use of if-expressions to display parameters will allow those parameters to pass leading/trailing spaces, such as for customizing the separators around the converted output amount. (This was an issue during August 2010.)

See also[edit]