Module:Convert/makeunits/doc: Difference between revisions
tweak |
update: now requires Module:Convert/text |
||
Line 5: | Line 5: | ||
This script reads wikitext defining units, and outputs a Lua script with tables containing that data: |
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]]. |
*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 output is manually copied to [[Module:Convert/data]] to replace its current contents. |
||
The <code> |
The <code>specials</code> 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 <code>wikidata.txt</code>. Alternatively, the [[wget]] command can be used to get the wikitext, as shown below. With the script saved in file <code>makeunits.lua</code>, use the command line to run. |
To run the script, edit the above conversion data page and copy its wikitext to a local file, say <code>wikidata.txt</code>. Alternatively, the [[wget]] command can be used to get the wikitext, as shown below. With the script saved in file <code>makeunits.lua</code>, use the command line to run. |
||
<pre> |
<pre> |
||
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 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 wikidata.txt |
lua makeunits.lua converttext wikidata.txt |
||
</pre> |
</pre> |
||
Revision as of 09:45, 4 September 2013
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.