Module:Convert/makeunits/doc
![]() | This is a documentation subpage for Module:Convert/makeunits. It may contain usage information, categories and other content that is not part of the original module page. |
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 input is the wikitext at User:Johnuniq/Conversion data.
- Additional input for localization is read from Module:Convert/text.
- The output is manually copied to Module:Convert/data to replace its current contents.
The specials
table is used to insert 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 makeunits.lua http://en.wikipedia.org/wiki/Module:Convert/makeunits?action=raw wget -O wikidata.txt http://en.wikipedia.org/wiki/User:Johnuniq/Conversion_data?action=raw wget -O converttext.lua http://en.wikipedia.org/wiki/Module:Convert/text?action=raw lua makeunits.lua converttext wikidata.txt
On some systems, "lua
" is not needed.
By default, the script creates output file makeunits.tmp
. Use that file to replace the contents of Module:Convert/data.