Content deleted Content added
getPropOfProp |
Adamant.pwn (talk | contribs) populating language |
||
Line 2:
local wdib = require('Module:WikidataIB')
local getValue = wdib._getValue
local getPropOfProp = wdib.
local simple_properties = { -- PXXX, is multiple?, linked?
Line 32:
url = {id="P953", maxvals=1}, -- full work available at
pages = {id="P304", maxvals=1},
translator = {id="P655", maxvals=0}, -- does **not** go to "others" section!
illustrator = {id="P110", maxvals=0, others=true}, -- goes to "others" section
Line 204 ⟶ 203:
function citeq.cite_q (frame)
local citeq_args = {};
for k, v in pairs(frame:getParent().args) do
Line 214 ⟶ 211:
citeq_args[k] = v
end
local qid = citeq_args.qid
local wdl = citeq_args.wdl
local oth = {}
citeq_args.language = citeq_args.language or getPropOfProp( {qid = qid, prop1 = "P407", prop2 = "P218", ps = 1} )
for name, data in pairs(simple_properties) do
citeq_args[name] = getValue( {data.id, ps = 1, qid =
if data.others then
oth[#oth+1] = citeq_args[name] and (name:gsub("^%l", string.upper) .. ": " .. citeq_args[name])
Line 227 ⟶ 231:
citeq_args.journal = citeq_args.journal and citeq_args.journal:gsub("^''", ""):gsub("''$", ""):gsub("|''", "|"):gsub("'']]", "]]")
citeq_args.ol = (getValue( {"P648", ps = 1, qid =
citeq_args.biorxiv = citeq_args.biorxiv and ("10.1101/" .. citeq_args.biorxiv)
citeq_args.isbn = getValue( {"P957", ps = 1, qid =
citeq_args.url = getValue( {"P856", ps = 1, qid =
citeq_args.url = getValue( {"P2699", ps = 1, qid =
local slink = mw.wikibase.getSitelink(
local label = mw.wikibase.getLabel(
if citeq_args.title then
if slink then
Line 267 ⟶ 271:
for k, v in pairs(citeq_args) do
▲ citeq_args[k] = nil
▲ citeq_args[k] = nil
if v == 'unset' or type(k) ~= 'string' then
citeq_args[k] = nil
|