Content deleted Content added
modify to output links as authorlink |
sync with master version |
||
Line 13:
--[=[-------------------------< G E T _ N A
arguments:
nl_type - type of name list to fetch: nl_type = 'author' for authors; 'editor' for editors
args - pointer to the parameter arguments table from the template call
qid - value from |qid= parameter; the Q-id of the source (book, etc.) in qid
Line 25 ⟶ 26:
]=]
local function
local propertyID = "P50"
if 'author' == nl_type then
propertyID = 'P50'; -- for authors
elseif 'editor' == nl_type then
propertyID = 'P98'; -- for editors
else
return; -- not specified so return
end
-- wdlinks is a boolean passed to enable links to Wikidata when no article exists
Line 58 ⟶ 67:
-- So now we have something to return:
-- table 'out' is going
-- and table 'link' will store any links to the
local out = {}
local link = {}
Line 74 ⟶ 83:
end
if sitelink then
-- just the plain
-- but keep a record of the links, using the same index
out[#out + 1] = label
Line 110 ⟶ 119:
end
-- if there's anything to return, then
-- in the form |author1=firstname secondname |author2= ...
if #out > 0 then
for k,v in ipairs(out) do -- authorn or editorn▼
▲ for k,v in ipairs(out) do
▲ args[parameter_name] = v
end
for k,v in pairs(link) do -- author-linkn or editor-linkn
end
end
Line 139 ⟶ 145:
local wdl;
local
local args = pframe.args; -- first get parent frame arguments - these from the template call
for k, v in pairs (args) do -- copy named parameters and their values into citeq_args
if type( k ) == 'string' then -- numbered parameters ignored
citeq_args[k] = v;
end
end
args = frame.args; -- now get frame arguments (from the template wikisource)
for k, v in pairs (args) do -- copy args into citeq_args
Line 150 ⟶ 165:
end
end
if is_set (qid) then
if not is_set (citeq_args.author) and not is_set (citeq_args.author1) then -- if neither are set, try to get authors from wikidata end
▲ get_authors (citeq_args, qid, wdl); -- modify citeq_args table with authors from wikidata
if not is_set (citeq_args.editor) and not is_set (citeq_args.editor1) then -- if neither are set, try to get editors from wikidata
get_name_list ('editor', citeq_args, qid, wdl); -- modify citeq_args table with editors from wikidata
end
end
|