Split missing names tracking category into two by author name string (P2093)

This commit is contained in:
Jonathan Harker 2026-10-31 12:26:24 +13:00
parent f057618b52
commit 2161da1eff
2 changed files with 13 additions and 17 deletions

View file

@ -862,44 +862,39 @@ local function _cite_q (citeq_args)
for i, author in pairs(names.authors or {}) do
-- mw.logObject(author)
if not author.last and i <= (tonumber(citeq_args['display-authors']) or author_count) then
if author.qid then
if author.qid then -- checks for author (P50) vs. author name string (P2093)
-- ignore anonymous or non-humans
if author.human then
table.insert(missing_names, string.format (cfg.i18n_t.errors.missing_name, author.label, 'author', author.qid));
tableset_add(opt_cat, cfg.i18n_t.trackingcats['missing-author-first-last-names'])
end
else
tableset_add(opt_cat, cfg.i18n_t.trackingcats['missing-authorstring-first-last-names'])
table.insert(missing_names, author.label)
end
end
end
for i, editor in pairs(names.editors or {}) do
if not editor.last and i <= (tonumber(citeq_args['display-editors']) or editor_count) then
if editor.qid then
-- ignore anonymous or non-humans
if editor.human then
table.insert(missing_names, string.format (cfg.i18n_t.errors.missing_name, editor.label, 'editor', editor.qid));
end
else
table.insert(missing_names, editor.label)
-- ignore anonymous or non-humans
if editor.human then
table.insert(missing_names, string.format (cfg.i18n_t.errors.missing_name, editor.label, 'editor', editor.qid));
tableset_add(opt_cat, cfg.i18n_t.trackingcats['missing-author-first-last-names'])
end
end
end
for i, translator in pairs(names.translators or {}) do
if not translator.last then
if translator.qid then
-- ignore anonymous or non-humans
if translator.human then
table.insert(missing_names, string.format (cfg.i18n_t.errors.missing_name, translator.label, 'translator', translator.qid));
end
else
table.insert(missing_names, translator.label)
-- ignore anonymous or non-humans
if translator.human then
table.insert(missing_names, string.format (cfg.i18n_t.errors.missing_name, translator.label, 'translator', translator.qid));
tableset_add(opt_cat, cfg.i18n_t.trackingcats['missing-author-first-last-names'])
end
end
end
-- add category and display error if name errors found
-- add display error if name errors found
if #missing_names > 0 and not in_array('missing-author-first-last-names', opt_cat) then
tableset_add(opt_cat, cfg.i18n_t.trackingcats['missing-author-first-last-names'])
-- TODO: format and i18n this string
cq_errors = cq_errors .. ' <span class="error" style="font-size:inherit"><code class="cs1-code">{{[[Template:Cite Q|Cite Q]]}}</code>: Missing first/last names in Wikidata for ' .. table.concat(missing_names, ', ') .. ' ([[Template:Cite Q#Error messages|help]])</span> '
end