Thesis and retracted support sync from sandbox, 1 September 2026
This commit is contained in:
parent
6df6071a72
commit
fbc531998a
2 changed files with 48 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ local followQid = wdib._followQid
|
|||
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
|
||||
local cs1_module = 'Module:Citation/CS1' -- don't load the module yet, may not be needed
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- makeOrdinal needs to be internationalised along with cfg.i18n_t
|
||||
|
|
@ -427,6 +427,19 @@ local function _cite_q (citeq_args)
|
|||
if stated_as then citeq_args.publisher = stated_as end
|
||||
end
|
||||
|
||||
-- Handle thesis args - degree, supervising institution
|
||||
local is_thesis = false
|
||||
if citeq_args.thesis_degree then
|
||||
is_thesis = true
|
||||
citeq_args.degree = citeq_args.thesis_degree
|
||||
citeq_args.thesis_degree = nil
|
||||
end
|
||||
if citeq_args.thesis_submitted_to then
|
||||
is_thesis = true
|
||||
citeq_args.publisher = citeq_args.thesis_submitted_to
|
||||
citeq_args.thesis_submitted_to = nil
|
||||
end
|
||||
|
||||
if not titleforced then
|
||||
-- Handle subtitle.
|
||||
if citeq_args.title then
|
||||
|
|
@ -578,6 +591,8 @@ local function _cite_q (citeq_args)
|
|||
citeq_args.asin = nil -- suppress ASIN if ISBN exists
|
||||
elseif citeq_args.journal then
|
||||
template = template or "journal"
|
||||
elseif is_thesis then
|
||||
template = template or "thesis"
|
||||
elseif citeq_args.website then
|
||||
template = template or "web"
|
||||
end
|
||||
|
|
@ -598,6 +613,34 @@ local function _cite_q (citeq_args)
|
|||
citeq_args.id = id
|
||||
end
|
||||
|
||||
local opt_cat = ''
|
||||
|
||||
-- Indicator if item has been retracted
|
||||
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 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 = 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
|
||||
if 'yes' == citeq_args['retracted-intentional'] then
|
||||
retr_params.intentional = 'yes'
|
||||
end
|
||||
retract = ' ' .. frame:expandTemplate{ title = "Retracted", args = retr_params }
|
||||
end
|
||||
-- remove non-CS1 retraction properties
|
||||
citeq_args.retracted_by = nil
|
||||
citeq_args['retracted-intentional'] = nil
|
||||
|
||||
-- clean up any blank parameters
|
||||
for k, v in pairs(citeq_args) do
|
||||
if v == "" then citeq_args[k] = nil end
|
||||
|
|
@ -632,10 +675,6 @@ local function _cite_q (citeq_args)
|
|||
erratumid = ""
|
||||
end
|
||||
|
||||
local opt_cat = ''
|
||||
if getValue( {"P5824", ps = 1, qid = qid} ) then
|
||||
opt_cat = cfg.i18n_t.trackingcats.retracted
|
||||
end
|
||||
if getValue( {"P1366", ps = 1, qid = qid} ) then
|
||||
opt_cat = opt_cat .. cfg.i18n_t.trackingcats.replaced
|
||||
end
|
||||
|
|
@ -654,7 +693,7 @@ local function _cite_q (citeq_args)
|
|||
title = "Cite "..template, args = citeq_args
|
||||
} .. cfg.i18n_t.trackingcats["unknown-template"]
|
||||
end
|
||||
return output .. erratumid .. opt_cat
|
||||
return output .. erratumid .. retract .. opt_cat
|
||||
end
|
||||
|
||||
local function cite_q (frame)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue