Module talk:Convert
Overview
This module provides a possible implementation of {{convert}}. Associated pages are:
- Template:Convert/sandboxlua – template which invokes the module
- Template:Convert/testcases – template tests
- Module:Convert – module to convert units
- Module:Convertdata – module with unit definitions, used by #3
- User:Johnuniq/Conversion data – master list of unit definitions
- User:Johnuniq/Making the units table – program to translate #5 to #4
- Template talk:Convert#Lua Module:Convert – some notes about plans
Usage examples:
{{convert|5.2|m|ftin}}
→ 5.2 metres (17 ft 1 in){{convert|5+3/8|in}}
→ 5+3⁄8 inches (140 mm){{convert|60|x|120|m|ft}}
→ 60 by 120 metres (200 ft × 390 ft)
Currently, the real master list of unit definitions is a text file on my computer (I have a script to convert that text file to the wikitext used at #5). The uniformly formatted text file is easier for making bulk changes, but will be discarded when the module nears completion.
In addition to the test page (#2 above), I run a test program on my local system that feeds hundreds of tests into the module.
Module:Convert has many issues to be fixed, and some features that need to be implemented. It does not support inputs with multiple units, such as 3 ft 6 in
, and does not support large scale units like e3km
. Complex units like the hand
unit of length have not been implemented, and there are hundreds of unit codes that are not yet defined (the units which are defined are listed at #5).
Some interesting performance challenges exist. The "NewPP limit report" in the html source for this test page says "Lua time usage: 0.295s". Johnuniq (talk) 09:35, 19 February 2013 (UTC)