Module:Convert: Difference between revisions

(update from sandbox per Template talk:Convert#Module version 18)
(update from sandbox per Template talk:Convert#Module version 19)
Line 1,758:
-- Return true if successful or return false, t where t is an error message table.
currency_text = nil -- local testing can hold module in memory; must clear globals
local accept_any_text = {
input = true,
qid = true,
qual = true,
stylein = true,
styleout = true,
tracking = true,
}
if kv_pairs.adj and kv_pairs.sing then
-- For enwiki (before translation), warn if attempt to use adj and sing
Line 1,794 ⟶ 1,802:
end
end
elseif accept_any_text[en_name] then
elseif en_name == 'stylein' or en_name == 'styleout' or en_name == 'qual' or en_name == 'qid' or en_name == 'input' then
en_value = loc_value ~= '' and loc_value or nil -- accept non-empty user text with no validation
if en_name == 'input' then
Line 3,651 ⟶ 3,659:
-- An unknown input unit would display the input and an error message
-- with success == true at this point.
-- Also, can have success == false with a message tothat outputoutputs an empty string.
if successparms.input_text then
if parms.have_problemsuccess and not parms.input_texthave_problem then
return parms.input_textresult
end
local cat
return result
if parms.tracking then
-- Add a tracking category using the given text as the category sort key.
-- There is currently only one type of tracking, but in principle multiple
-- items could be tracked, using different sort keys for convenience.
cat = wanted_category('tracking', parms.tracking)
end
return parms.input_text .. (cat or '')
end
return parms.input_textsuccess and parms.input_textresult or message(parms, result)
end
 
Anonymous user