Content deleted Content added
Adamant.pwn (talk | contribs) another fallback for the language of the property |
Adamant.pwn (talk | contribs) populate language from journal |
||
Line 3:
local getValue = wdib._getValue
local getPropOfProp = wdib._getPropOfProp
local followQid = wdib._followQid
local simple_properties = { -- PXXX, is multiple?, linked?
Line 9 ⟶ 10:
place = {id="P291", maxvals=0,linked='no'},
doi = {id="P356", maxvals=1},
issue = {id="P433", maxvals=1, populate_from_journal = true},
pmid = {id="P698", maxvals=1},
arxiv = {id="P818", maxvals=1},
Line 24 ⟶ 25:
osti = {id="P3894", maxvals=1},
biorxiv = {id="P3951", maxvals=1},
isbn = {id="P212", maxvals=1, populate_from_journal = true}, -- ISBN 13
chapter = {id="P792", maxvals=1},
["date"] = {id="P577", maxvals=1, populate_from_journal = true},
series = {id="P179", maxvals=1, populate_from_journal = true},
volume = {id="P478", maxvals=1, populate_from_journal = true},
title = {id="P1476", maxvals=1},
url = {id="P953", maxvals=1}, -- full work available at
pages = {id="P304", maxvals=1, populate_from_journal = true},
translator = {id="P655", maxvals=0}, -- does **not** go to "others" section!
illustrator = {id="P110", maxvals=0, others=true}, -- goes to "others" section
Line 224 ⟶ 225:
citeq_args.language = citeq_args.language or getPropOfProp( {qid = qid, prop1 = "P407", prop2 = "P218", ps = 1} )
citeq_args.language = nil
end▼
-- try fallback to journal's language
local journal_qid = followQid({qid = qid, props = "P1433"})
citeq_args.language = journal_qid and getPropOfProp( {qid = journal_qid, prop1 = "P407", prop2 = "P218", ps = 1} )
end▼
for name, data in pairs(simple_properties) do
citeq_args[name] = getValue( {data.id, ps = 1, qid = qid, maxvals=data.maxvals, linked=data.linked, citeq_args[name] } )
if data.populate_from_journal then
citeq_args[
citeq_args[name] = citeq_args[name] or getPropOfProp({qid = qid, prop1 = "P1433", prop2 = data.id})
if citeq_args[name] and citeq_args[name]:find('[[Category:Articles with missing Wikidata information]]', 1, true) then
-- try fallback to work's native language
Line 254 ⟶ 268:
citeq_args.url = getValue( {"P856", ps = 1, qid = qid, maxvals=0, citeq_args.url } ) -- try official website
citeq_args.url = getValue( {"P2699", ps = 1, qid = qid, maxvals=0, citeq_args.url } ) -- try url
▲ citeq_args['date'] = getValue( {"P1433", ps = 1, qid = qid, maxvals=0, citeq_args['date'], qual='P577', qualsonly='yes' } )
▲ end
▲ if not citeq_args.issue then
▲ end
▲ if not citeq_args.volume then
▲ end
local slink = mw.wikibase.getSitelink(qid)
|