Module talk:Convert

This is an old revision of this page, as edited by קיפודנחש (talk | contribs) at 16:45, 2 March 2013 (Overview: mw.loadData ?). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 12 years ago by קיפודנחש in topic Overview

Overview

This module provides a possible implementation of {{convert}}. Associated pages are:

  1. Template:Convert/sandboxlua – template which invokes the module
  2. Template:Convert/testcases – template tests
  3. Module:Convert – module to convert units
  4. Module:Convertdata – module with unit definitions, used by #3
  5. User:Johnuniq/Conversion data – master list of unit definitions
  6. User:Johnuniq/Making the units table – program to translate #5 to #4
  7. 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+38 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)Reply

presuming that a page that requires data conversion might require many of them, and consideing the sheer size of Module:Convertdata, you might want to look at the mw.loadData documentaion and see if you can use this to improve performance. peace - קיפודנחש (aka kipod) (talk) 16:45, 2 March 2013 (UTC)Reply