Module talk:Sandbox/RexxS/Unitsdemo
< Module talk:Sandbox | RexxS
Latest comment: 8 years ago by RexxS in topic Simplifying
Simplifying
editAs there are a very large number of units that may potentially be used, I've dropped the entries for abbreviation, as {{convert}} already has the functionality.
Because plurals are most often simply the singular + "s", the Unitsdemo code now performs that if the singular version of the unit exists, but the plural does not. That allows us to add new units by adding just {QID, singular name, code required by convert}. --RexxS (talk) 16:47, 29 April 2016 (UTC)
Checking
editTesting
edit{{#invoke:Sandbox/RexxS/Unitsdemo|conv|Q11573}}
>> m{{#invoke:Sandbox/RexxS/Unitsdemo|conv|Q11574}}
>> convert code not known{{#invoke:Sandbox/RexxS/Unitsdemo|sing|Q25343}}
>> square metre{{#invoke:Sandbox/RexxS/Unitsdemo|plur|Q25343}}
>> square metres{{#invoke:Sandbox/RexxS/Unitsdemo|conv|Q25343}}
>> m2{{#invoke:Sandbox/RexxS/Unitsdemo|sing|Q25343}}
>> square foot{{#invoke:Sandbox/RexxS/Unitsdemo|plur|Q25343}}
>> square feet{{#invoke:Sandbox/RexxS/Unitsdemo|conv|Q25343}}
>> sqft{{#invoke:Sandbox/RexxS/Unitsdemo|sing|Q25343}}
>> pound per square inch{{#invoke:Sandbox/RexxS/Unitsdemo|plur|Q25343}}
>> pounds per square inch{{#invoke:Sandbox/RexxS/Unitsdemo|conv|Q11573}}
>> psi
Using Convert
edit{{convert | 10.0 | {{#invoke:Sandbox/RexxS/Unitsdemo|conv|Q25343}} }}
>> 10.0 square metres (108 sq ft)