Use Erratum template, qidonly config lookups, 5 September 2026
This commit is contained in:
parent
fbc531998a
commit
d0298adb5d
2 changed files with 50 additions and 21 deletions
|
|
@ -4,7 +4,7 @@ local wdib = require('Module:WikidataIB')
|
|||
local getValue = wdib._getValue
|
||||
local _getPropOfProp = wdib._getPropOfProp
|
||||
local followQid = wdib._followQid
|
||||
local getPropertyIDs = wdib._getPropertyIDs
|
||||
--local getPropertyIDs = wdib._getPropertyIDs
|
||||
local cite_cfg = mw.loadData ('Module:Cite/config')
|
||||
local cfg = mw.loadData ('Module:Cite_Q/config')
|
||||
local cs1_module = 'Module:Citation/CS1' -- don't load the module yet, may not be needed
|
||||
|
|
@ -157,8 +157,8 @@ returns nothing; modifies the args table
|
|||
]=]
|
||||
|
||||
local function get_name_list (nl_type, args, qid, wdl)
|
||||
local propertyID = "P50"
|
||||
local fallbackID = "P2093" -- author name string
|
||||
local propertyID
|
||||
local fallbackID
|
||||
|
||||
if nl_type =="author" then
|
||||
propertyID = 'P50' -- for authors
|
||||
|
|
@ -357,7 +357,15 @@ local function _cite_q (citeq_args)
|
|||
|
||||
-- loop through list of simple properties and get their values in citeq_args
|
||||
for name, data in pairs(cfg.simple_properties_t) do
|
||||
citeq_args[name] = getValue( {data.id, fwd = "ALL", osd = "no", noicon = "true", qid = qid, maxvals = data.maxvals, linked = data.linked, rank = data.rank or "best", citeq_args[name] } )
|
||||
if data.qidonly then
|
||||
citeq_args[name] = followQid({qid = qid, props = data.id})
|
||||
if citeq_args[name] == qid then
|
||||
citeq_args[name] = nil
|
||||
end
|
||||
end
|
||||
if not citeq_args[name] then
|
||||
citeq_args[name] = getValue( {data.id, fwd = "ALL", osd = "no", noicon = "true", qid = qid, maxvals = data.maxvals, linked = data.linked, rank = data.rank or "best", citeq_args[name] } )
|
||||
end
|
||||
if data.populate_from_journal then
|
||||
local publishedin = getValue( {"P1433", ps = 1, qid = qid, maxvals = 0, citeq_args[name], qual = data.id, qualsonly = 'yes'} )
|
||||
citeq_args[name] = publishedin or _getPropOfProp({qid = qid, prop1 = "P1433", prop2 = data.id, maxvals = data.maxvals, ps = 1})
|
||||
|
|
@ -619,19 +627,18 @@ local function _cite_q (citeq_args)
|
|||
local retract = ''
|
||||
if citeq_args.retracted_by then
|
||||
opt_cat = cfg.i18n_t.trackingcats.retracted
|
||||
local retract_qid = followQid({qid = qid, props = "P5824"})
|
||||
local retract_id = string.gsub(retract_qid, 'Q', '')
|
||||
local retract_id = string.gsub(citeq_args.retracted_by, 'Q', '')
|
||||
local retr_params = {
|
||||
citeq = 'yes',
|
||||
id = frame:expandTemplate{
|
||||
title = 'QID', args = {qid = retract_id}
|
||||
}
|
||||
}
|
||||
retr_params.doi = getValue({"P356", ps = 1, qid = retract_qid}) or nil
|
||||
retr_params.doi = getValue({"P356", ps = 1, qid = citeq_args.retracted_by}) or nil
|
||||
retr_params.doi = retr_params.doi and retr_params.doi:lower() or nil
|
||||
retr_params.bibcode = getValue({"P819", ps = 1, qid = retract_qid}) or nil
|
||||
retr_params.pmc = getValue({"P932", ps = 1, qid = retract_qid}) or nil
|
||||
retr_params.pmid = getValue({"P698", ps = 1, qid = retract_qid}) or nil
|
||||
retr_params.bibcode = getValue({"P819", ps = 1, qid = citeq_args.retracted_by}) or nil
|
||||
retr_params.pmc = getValue({"P932", ps = 1, qid = citeq_args.retracted_by}) or nil
|
||||
retr_params.pmid = getValue({"P698", ps = 1, qid = citeq_args.retracted_by}) or nil
|
||||
if 'yes' == citeq_args['retracted-intentional'] then
|
||||
retr_params.intentional = 'yes'
|
||||
end
|
||||
|
|
@ -668,20 +675,40 @@ local function _cite_q (citeq_args)
|
|||
return frame:preprocess (table.concat ({'<syntaxhighlight lang="wikitext" inline="1">', table.concat (expand_args, ' |') .. '}}', '</syntaxhighlight>'}));
|
||||
end
|
||||
|
||||
local erratumid = getPropertyIDs( { "P2507", qid = qid, fwd = "ALL", osd = "no", rank = "best", maxvals = 1 } )
|
||||
if erratumid then
|
||||
erratumid = " [[d:" .. erratumid .. "|" .. cfg.i18n_t.erratum .. "]]" .. cfg.i18n_t.trackingcats.erratum
|
||||
else
|
||||
erratumid = ""
|
||||
-- Indicator if item has corrigendum/erratum
|
||||
local erratumid = ""
|
||||
if citeq_args.erratum then
|
||||
opt_cat = opt_cat .. cfg.i18n_t.trackingcats.erratum
|
||||
local erratum_params = {
|
||||
citeq = 'yes',
|
||||
id = frame:expandTemplate{
|
||||
title = 'QID', args = {qid = string.gsub(citeq_args.erratum, 'Q', '')}
|
||||
}
|
||||
}
|
||||
erratum_params.doi = getValue({"P356", ps = 1, qid = citeq_args.erratum}) or nil
|
||||
erratum_params.doi = erratum_params.doi and erratum_params.doi:lower() or nil
|
||||
erratum_params.bibcode = getValue({"P819", ps = 1, qid = citeq_args.erratum}) or nil
|
||||
erratum_params.pmc = getValue({"P932", ps = 1, qid = citeq_args.erratum}) or nil
|
||||
erratum_params.pmid = getValue({"P698", ps = 1, qid = citeq_args.erratum}) or nil
|
||||
if 'yes' == citeq_args['erratum-checked'] then
|
||||
erratum_params.checked = 'yes'
|
||||
end
|
||||
erratumid = ' ' .. frame:expandTemplate{ title = "Erratum", args = erratum_params }
|
||||
end
|
||||
citeq_args.erratum = nil
|
||||
citeq_args['erratum-checked'] = nil
|
||||
|
||||
if getValue( {"P1366", ps = 1, qid = qid} ) then
|
||||
if citeq_args.replaced_by then
|
||||
opt_cat = opt_cat .. cfg.i18n_t.trackingcats.replaced
|
||||
citeq_args.replaced_by = nil
|
||||
end
|
||||
if not citeq_args.title then -- emit category link if missing title
|
||||
opt_cat = opt_cat .. cfg.i18n_t.trackingcats['no-label-or-title'];
|
||||
end
|
||||
|
||||
-- Disable CiteSeerX IDs for now
|
||||
citeq_args.citeseerx = nil
|
||||
|
||||
-- render the template
|
||||
local lc_template = template and template:lower() or "citation"
|
||||
local output
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue