Anonymous user
Module:Convert: Difference between revisions
Jump to navigation
Jump to search
large refactor of messages; show input when only output is invalid (and when reasonably easy to do so)
(fix valid_number check to account for Scribunto using 'nan' or 'inf' for problem numbers) |
(large refactor of messages; show input when only output is invalid (and when reasonably easy to do so)) |
||
Line 199:
local msg = all_messages[mcode[1]]
if msg then
local
mcode[2] or '?',
mcode[3] or '?',
mcode[4] or '?')
local
local
local
local fmt = all_messages['cvt_format'] or 'convert: bug'
local regex, replace = msg.regex, msg.replace
if regex and replace then
end
title = title:gsub('"', '"')
return
end
return 'Convert internal error: unknown message'
Line 241 ⟶ 243:
success, speller = pcall(get_speller, spell_module)
if not success or type(speller) ~= 'function' then
add_warning(parms, '
return nil
end
Line 1,640 ⟶ 1,642:
end
if is_bad_precision then
else
parms.precision = precision▼
end
▲ parms.precision = precision
return true, parms, in_unit_table
end
Line 2,635 ⟶ 2,638:
-- or return false, t where t is an error message table.
linked_pages = {}
local success, bad_output, out_unit_table
local invalue1 = in_unit_table.valinfo[1].value
local out_unit = parms.out_unit
if out_unit == nil or out_unit == '' then
success, out_unit = get_default(invalue1, in_unit_table)
if not success then
bad_output = out_unit
end
end
if success then
local mismatch = check_mismatch(in_unit_table, out_unit_table)
▲ if mismatch then
bad_output = mismatch
end
else
bad_output = out_unit_table
end
end
local flipped = parms.opt_flip
Line 2,656 ⟶ 2,666:
if (part == 1 and not flipped) or (part == 2 and flipped) then
parts[part] = process_input(parms, in_unit_table)
elseif bad_output then
parts[part] = message(bad_output)
else
local outputs = {}
|