Module:Convert: Difference between revisions

Content deleted Content added
investigate weirdness which SOMETIMES gives a "Script error" (error mentions "text" so change our variable name)
more temporary changes to debug issue with mw.text, see User:Johnuniq/test
Line 4:
-- Conversion data is defined in another module because it is too large
-- to be conveniently included here.
local convertdata = require(is_test_run and "convertdata" or "Module:Convertdata")
-- A testing program can set the global variable 'is_test_run'.
local convertdata = require(is_test_run and "convertdata" or "Module:Convertdata")
local SIprefixes = convertdata.SIprefixes
local units = convertdata.units
Line 1,258 ⟶ 1,257:
local p = {}
-- The following sets global variable 'mw' to simulate what Scribunto will do.
local bodge = require(is_test_run and "mw" or "Module:mw") -- fix up mw.text.tag
 
function p.convert(frame)
set_config(frame)
local TESTING = 'uninitialized'
local success, parms, in_unit_table = get_parms(frame:getParent())
if success then
Line 1,271 ⟶ 1,270:
if not success then
local params = {style="color:black; background-color:orange;"}
TESTING =return mw.text.tag({name="span", contents="[[Module talk:Convert|Conversion error]]: " .. TESTING, params=params})
end
return TESTING