Skip ref param handling when authors and editors are supplied as params

This commit is contained in:
Jonathan Harker 2026-10-19 17:15:40 +13:00
parent ed199defcb
commit 3ed3baa833

View file

@ -770,19 +770,28 @@ local function _cite_q (citeq_args)
and not is_set (citeq_args.surname) and not is_set (citeq_args.surname1) and not is_set (citeq_args.surname) and not is_set (citeq_args.surname1)
and not is_set (citeq_args['author-last']) and not is_set (citeq_args['author-last1']) and not is_set (citeq_args['author1-last']) and not is_set (citeq_args['author-last']) and not is_set (citeq_args['author-last1']) and not is_set (citeq_args['author1-last'])
and not is_set (citeq_args['author-surname']) and not is_set (citeq_args['author-surname1']) and not is_set (citeq_args['author1-surname1']) then -- if neither are set, try to get authors from Wikidata and not is_set (citeq_args['author-surname']) and not is_set (citeq_args['author-surname1']) and not is_set (citeq_args['author1-surname1']) then -- if neither are set, try to get authors from Wikidata
names.authors = get_name_list ('author', citeq_args, qid, wdl) -- modify citeq_args table with authors from Wikidata names.authors = get_name_list ('author', citeq_args, qid, wdl) or {} -- modify citeq_args table with authors from Wikidata
else
names.authors = {}
names.authors_overridden = true
end end
if not is_set (citeq_args.editor) and not is_set (citeq_args.editor1) if not is_set (citeq_args.editor) and not is_set (citeq_args.editor1)
and not is_set (citeq_args['editor-last']) and not is_set (citeq_args['editor-last1']) and not is_set (citeq_args['editor1-last']) and not is_set (citeq_args['editor-last']) and not is_set (citeq_args['editor-last1']) and not is_set (citeq_args['editor1-last'])
and not is_set (citeq_args['editor-surname']) and not is_set (citeq_args['editor-surname1']) and not is_set (citeq_args['editor1-surname']) then -- if neither are set, try to get editors from Wikidata and not is_set (citeq_args['editor-surname']) and not is_set (citeq_args['editor-surname1']) and not is_set (citeq_args['editor1-surname']) then -- if neither are set, try to get editors from Wikidata
names.editors = get_name_list ('editor', citeq_args, qid, wdl) -- modify citeq_args table with editors from Wikidata names.editors = get_name_list ('editor', citeq_args, qid, wdl) or {} -- modify citeq_args table with editors from Wikidata
else
names.editors = {}
names.editors_overridden = true
end end
if not is_set (citeq_args.translator) and not is_set (citeq_args.translator1) if not is_set (citeq_args.translator) and not is_set (citeq_args.translator1)
and not is_set (citeq_args['translator-last']) and not is_set (citeq_args['translator-last1']) and not is_set (citeq_args['translator1-last']) and not is_set (citeq_args['translator-last']) and not is_set (citeq_args['translator-last1']) and not is_set (citeq_args['translator1-last'])
and not is_set (citeq_args['translator-surname']) and not is_set (citeq_args['translator-surname1']) and not is_set (citeq_args['translator1-surname']) then -- if neither are set, try to get translators from Wikidata and not is_set (citeq_args['translator-surname']) and not is_set (citeq_args['translator-surname1']) and not is_set (citeq_args['translator1-surname']) then -- if neither are set, try to get translators from Wikidata
names.translators = get_name_list ('translator', citeq_args, qid, wdl) -- modify citeq_args table with translators from Wikidata names.translators = get_name_list ('translator', citeq_args, qid, wdl) or {} -- modify citeq_args table with translators from Wikidata
else
names.translators = {}
names.translators_overridden = true
end end
end end
@ -875,7 +884,9 @@ local function _cite_q (citeq_args)
-- handle supplied {{para|ref}} for readable ID, avoid CS1 duplicate default error -- handle supplied {{para|ref}} for readable ID, avoid CS1 duplicate default error
local pubyear = yearFromDate(citeq_args['publication-date']) local pubyear = yearFromDate(citeq_args['publication-date'])
if citeq_args.ref and 'none' ~= citeq_args.ref then if names.authors_overridden or (#names.authors == 0 and names.editors_overridden) then
-- if names are supplied manually, then don't mess with supplied ref parameter
elseif citeq_args.ref and 'none' ~= citeq_args.ref then
local citeref = make_citeref(names.authors or names.editors, pubyear) local citeref = make_citeref(names.authors or names.editors, pubyear)
if citeq_args.ref == citeref then if citeq_args.ref == citeref then
citeq_args.ref = nil -- avoid CS1 maint: ref duplicates default citeq_args.ref = nil -- avoid CS1 maint: ref duplicates default