Content deleted Content added
Synch from sandbox; |
Synch from sandbox; |
||
Line 67:
--[[
form the contributors display list:
if |
if |display-authors=
if |display-authors=etal then displays all author names in last, first order and append et al.
if value assigned to |display-authors= is less than the number of author last names, displays the specified number of author names in last, first order followed by et al.
]]
if
local i = 1;
local count;
local etal = false; -- when |display-authors= is same as number of authors in contributor list
if
count = #args.last; -- so set count accordingly▼
count = #args.last; -- display all authors and ...
▲ elseif 'etal' == args.display_authors:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
else▼
etal = true; -- ... append 'at al.'▼
▲ else
if 0 >= count then▼
▲ count = tonumber (args.display_authors) or 0; -- 0 if can't be converted to a number
args.err_msg = args.err_msg .. ' invalid |display-authors='; -- if zero, then emit error message▼
▲ if 0 >= count then
end▼
▲ args.err_msg = args.err_msg .. ' invalid |display-authors='; -- if zero, then emit error message
end
if count > #args.last then▼
count = #args.last;
end▼
end
else
end
▲ if count > #args.last then
▲ count = #args.last; -- when |display-authors= is more than the number of authors, use the number of authors
▲ end
▲ if count < #args.last then -- when |display-authors= is less than the number of authors
▲ end
while i <= count do
if is_set (contributors) then
Line 102 ⟶ 106:
end
if true == etal then
contributors = contributors .. ' et al.'; -- append et al.
elseif 'yes' == args.last_author_amp then
contributors = contributors:gsub('; ([^;]+)$', ' & %1') -- replace last separator with ' & '
end
else -- do default harv- or sfn-style contributor display
Line 208 ⟶ 214:
args.display_authors = pframe.args['display-authors']; -- the number of contributor names to display; cs1/2 format includes first names
args.name_list_format = pframe.args['name-list-format']; -- when set to 'harv' display contributor list in sfn or harv style
args.last_author_amp = pframe.args['last-author-amp'] or -- yes only; |last-author-amp=no does not work (though it does in CS1|2)
pframe.args['lastauthoramp'] or '';
args.last_author_amp:lower(); -- make it case agnostic
if is_set (pframe.args['last1']) or is_set (pframe.args['last']) then -- must have at least this to continue
args.last[1] = pframe.args.last or pframe.args.last1; -- get first contributor's last name
|