From 3ed3baa833dfdab88b7707a38b26cc4921979299 Mon Sep 17 00:00:00 2001 From: Jonathan Harker Date: Mon, 19 Oct 2026 17:15:40 +1300 Subject: [PATCH] Skip ref param handling when authors and editors are supplied as params --- module_citeq.lua | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/module_citeq.lua b/module_citeq.lua index 41c17d5..28e5bee 100644 --- a/module_citeq.lua +++ b/module_citeq.lua @@ -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['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 - 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 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-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 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-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 @@ -875,7 +884,9 @@ local function _cite_q (citeq_args) -- handle supplied {{para|ref}} for readable ID, avoid CS1 duplicate default error 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) if citeq_args.ref == citeref then citeq_args.ref = nil -- avoid CS1 maint: ref duplicates default