Module:Citation/CS1: Difference between revisions
No edit summary |
No edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1,661: | Line 1,661: | ||
local function get_display_names (max, count, list_name, etal) | local function get_display_names (max, count, list_name, etal) | ||
if is_set (max) then | |||
if is_set ( | if 'etal' == max:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings | ||
if 'etal' == | max = count + 1; -- number of authors + 1 so display all author name plus et al. | ||
etal = true; -- overrides value set by extract_names() | etal = true; -- overrides value set by extract_names() | ||
elseif | elseif max:match ('^%d+$') then -- if is a string of numbers | ||
max = tonumber (max); -- make it a number | |||
if | if max >= count then -- if |display-xxxxors= value greater than or equal to number of authors/editors | ||
add_maint_cat ('disp_name', cfg.special_case_translation [list_name]); | add_maint_cat ('disp_name', cfg.special_case_translation [list_name]); | ||
end | end | ||
else -- not a valid keyword or number | else -- not a valid keyword or number | ||
table.insert( z.message_tail, { set_error( 'invalid_param_val', {'display-' .. list_name, | table.insert( z.message_tail, { set_error( 'invalid_param_val', {'display-' .. list_name, max}, true ) } ); -- add error message | ||
max = nil; -- unset; as if |display-xxxxors= had not been set | |||
end | end | ||
end | end | ||
if count > 1 then | |||
return | etal = true; | ||
else | |||
etal = false; | |||
end | |||
return 1, etal; | |||
end | end | ||