Jump to content

Module:Convert/makeunits/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Johnuniq (talk | contribs) at 04:19, 11 June 2013 (purpose is to prepare units data). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

The purpose of this module is to prepare the data used by Module:Convert to allow conversion between units of measurement.

This module is run on a stand-alone computer—it currently will not run as a module because it uses loadstring() to evaluate expressions, and that is not allowed in Scribunto.

This script reads wikitext defining units, and outputs a Lua script with tables containing that data:

The set_builtins() function inserts a small amount of "built-in" data that is not currently defined in the input wikitext.

To run the script, edit the above conversion data page and copy its wikitext to a local file, say wikidata.txt. Alternatively, the wget command can be used to get the wikitext, as shown below. With the script saved in file makeunits.lua, use the command line to run.

wget -O wikidata.txt http://en.wikipedia.org/wiki/User:Johnuniq/Conversion_data?action=raw
lua makeunits.lua wikidata.txt

On some systems, "lua" is not needed.