Module:Harvc: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 40:
author list. It is presumed that the dates of contributions are the same as the date of the enclosing work.
 
Even though not displayed, a date positionalyear parameter is still required for the CITEREF anchor
 
]]
Line 59:
end
 
if is_set (args.last4) ~=and '' andis_set (args.last3) ~=and '' andis_set (args.last2) ~=and '' andis_set (args.last1 ~= '') then
contributors = args.last1 .. args.first .. ' et al.';
elseif is_set (args.last3) ~=and '' andis_set (args.last2) ~=and '' andis_set (args.last1 ~= '') then
contributors = args.last1 .. args.first .. ', ' .. args.last2 .. ' & ' .. args.last3;
elseif is_set (args.last2) ~=and '' andis_set (args.last1 ~= '') then
contributors = args.last1 .. args.first .. ' & ' .. args.last2;
elseif is_set (args.last1 ~= '') then
contributors = args.last1 .. args.first;
else
Line 72:
 
--form the source author-date list
if is_set (args.in4) ~=and '' andis_set (args.in3) ~=and '' andis_set (args.in2) ~=and '' andis_set (args.in1 ~= '') then
source = args.in1 .. ' et al.';
elseif is_set (args.in3) ~=and '' andis_set (args.in2) ~=and '' andis_set (args.in1 ~= '') then
source = args.in1 .. ', ' .. args.in2 .. ' & ' .. args.in3;
elseif is_set (args.in2) ~=and '' andis_set (args.in1 ~= '') then
source = args.in1 .. ' & ' .. args.in2;
elseif is_set (args.in1 ~= '') then
source = args.in1;
else
Line 84:
end
 
if args.year:match('^[1-9]%d%d%d%l?') then -- four digits with possible disambiguator
if '' ~= args.year then
source = source .. ' (' .. args.year .. ')';
else
args.err_msg = args.err_msg .. ' invalid or missing year.'; -- error message if year not provided or malformed
end
 
--assemble CITEREF wikilink
source = "[[#CITEREF" .. mw.uri.anchorEncode(table.concat ({args.in1, args.in2, args.in3, args.in4, args.year})) .. "|" .. source .. "]]";
 
Line 101 ⟶ 102:
end
 
-- pages and other insource ___location
if args.p ~= '' then
args.p = args.page_sep .. args.p;
elseif args.pp ~= '' then
args.p = args.pages_sep .. args.pp; -- args.p not set so use it to hold common insource ___location info
end
if args.loc ~= '' then
args.locp = args.p .. ', ' .. args.loc; -- add arg.loc to args.p
end
 
args.p = args.p .. args.loc;
--wrap error messages in span
args.err_msg = '<span style="font-size:100%" class="error">' .. args.err_msg .. '</span>';
Line 165 ⟶ 166:
args.postscript = '.'; -- separator not CS2 and postscript not set; use default terminal punctuation
end
else -- if here, postscript set
if 'none' == args.postscript:lower() then -- if |ps=none or |postscript=none then
args.postscript = ''; -- no postscript
end
end
if not is_set (args.separator) then
args.separator = '.'; -- not set in template and we didn't set it here so set to default
end
 
--[[
args.postscript = pframe.args.ps or pframe.args.postscript or '';
if '' ~= args.postscript then
if 'none' == args.postscript:lower() then -- if |ps=none or |postscript=none then
args.postscript = ''; -- no postscript
end
else -- if |postscript= omitted or present but empty
args.postscript = '.'; -- use default postscript
end
args.separator = pframe.args.separator or '.'; -- element separator defaults to full stop
]]
 
args.url = pframe.args.url or ''; -- url for chapter or contribution
Line 190 ⟶ 179:
args.year = pframe.args.year or '';
 
if ''not ==is_set (args.contribution) then
args.err_msg = args.err_msg .. ' required contribution is missing.'; -- error message if source not provided
args.contribution = url; -- if set it will give us linkable text
-- args.url=''; -- if no contribution set url to empty string so we don't link the error message
end