跳转到内容

模組:Taxobox wikidata/sandbox

本页使用了标题或全文手工转换
维基百科,自由的百科全书
local wdib = require('Module:WikidataIB')

local p = {}
local l = {}

function p.main(frame)
    return l.getDataRaw('Q42196', 'P105')
end

local function has_content(arg)
    return arg ~= nil and arg ~= ""
end


function l.getData(args, id)
	local opts = {id}
	opts.qid = has_content(args.qid) and args.qid or nil
	opts.onlysourced = has_content(args.onlysourced) and args.onlysourced or "no"
	opts.noicon = has_content(args.noicon) and args.noicon or "true"
	opts.fetchwikidata = has_content(args.fetchwikidata) and args.fetchwikidata or "ALL"
    opts.suppressfields = has_content(args.suppressfields) and args.suppressfields or nil
	return wdib._getValue(opts)
end

function l.getDataRaw(qid, pid)
	local opts = {pid}
	opts.qid = qid
	opts.onlysourced = "no"
	opts.noicon = "true"
	opts.fetchwikidata = "ALL"
    opts.plaindate = "no"
    opts.rank = 'best'
    opts.linked = "no"
    opts.qualsonly = "yes"
	return wdib._getValue(opts)
end

return p