Content deleted Content added
fix parameter the way that Trappist likes |
No edit summary |
||
Line 85:
local template = (args_t.template and args_t.template) or 'native name'; -- for error messaging; use 'native name list' when called from native_name_list(), etc
if not (args_t[1] or args_t[2]) and yes_no (args_t.suppress_empty_list_error) then
return error_msg ((args_t.index and messages_t.tag_required_idx) or messages_t.tag_required, template, args_t.index)
elseif not args_t[2] then
▲ if not args_t[2] then
return error_msg ((args_t.index and messages_t.name_required_idx) or messages_t.name_required, template, args_t.index)
end
Line 117 ⟶ 118:
else
if lang_module._is_ietf_tag (args_t[1]) then
table.insert (out_t,
else
table.insert (out_t, '(language?)'); -- TODO: any reason to keep this?
Line 168 ⟶ 169:
end
local unsorted_enumerators_t = {} -- unsorted k/v table of tagn and namen enumerators where k is the enumerator and v is always true
for param, _ in pairs (args_t) do -- loop through all parameters
local enumerator = mw.ustring.match (param, "^tag(%d+)$") -- is this a |tagn= parameter? extract enumerator if present
if enumerator then -- if there is an enumerator
unsorted_enumerators_t[tonumber(enumerator)] = true -- add enumerator to the table
else
local name_match = mw.ustring.match (param, "^name(%d+)$") -- is this a |tagn= parameter? extract enumerator if
if name_match then -- if there is an enumerator
end
end
end
local enumerators_t = {} -- will hold a sorted sequence of enumerators
for n, _ in pairs (
table.insert (
end
table.sort (
local list_t = {}; -- list of formatted native names goes here
for _, n in ipairs (
table.insert (list_t, table.concat ({
'<li>', -- open the list item
Line 220:
return out; -- to avoid replacement count contaminating the output
end
else -- list is empty; when error message suppressed:
▲ return '' -- if empty list error is suppressed, return blank
▲ return error_msg (messages_t.empty_list, 'native name list'); -- else return error
end
|