Xiayu讨论 | 贡献2020年7月8日 (三) 11:36的版本 (导入1个版本)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

模块:Uses Wikidata

来自中文乐谱库

此模块的文档可以在模块:Uses Wikidata/doc创建

脚本错误:Lua错误:无法创建进程:proc_open(/dev/null): failed to open stream: Operation not permitted

local p = {}

function p.usesProperty(frame)
	local parent = frame.getParent(frame)
	local result = ''
	local ii = 1
	while true do
		local p_num = parent.args[ii] or ''
		if p_num ~= '' then
			local label = mw.wikibase.label(p_num) or "NO LABEL"
			result = result .. "<li><b>[[d:Property:" .. p_num .. "|" .. label .. " <small>(" .. string.upper(p_num) .. ")</small>]]</b>([[d:Special:WhatLinksHere/Property:" .. p_num .. "|使用情况]])</li>"
			ii = ii + 1
		else break
		end
	end
	return result
end
--混和模板
function p.Tracks_Wikidata(frame)
	local parent = frame.getParent(frame)
	local result = ''
	local ii = 1
	while true do
		local p_num = parent.args[ii] or ''
		if p_num ~= '' then
			local label = mw.wikibase.label(p_num) or "NO LABEL"
			result = result .. "<li><b>[[d:Property:" .. p_num .. "|" .. label .. " <small>(" .. string.upper(p_num) .. ")</small>]]</b>([[d:Special:WhatLinksHere/Property:" .. p_num .. "|使用情况]])</li>"
			ii = ii + 1
		else break
		end
	end
	local template = frame:expandTemplate{
		    title = "Sister project",
		    args = {"image=" .. frame:expandTemplate{
		        title = "Sister project",
		        args = {"base = Wikidata-logo.svg",
		        	    "base_width = 40px",
		        	    "base_link = Wikipedia:Wikidata",
		        	    "float = Magnifying glass icon mgx2.svg",
		        	    "float_link = Wikipedia:Wikidata",
		        	    "float_width = 28px",
		        	    "x = 12",
		        	    "y = 0"
		        }},"position = " .. (parent.args["position"] or ""),
		        "text = 本" .. frame:expandTemplate{title = "NS1/Wikidata"} .. "[[:Category:" .. ( parent.args["cat"] or "维基数据跟踪分类") .. "|跟踪]]" .. ( parent.args["section"] and " 一个或多个[[维基数据]]属性。更多細節請參見[[#" .. parent.args["section"] .."|§&nbsp;" .. parent.args["section"] .. "]]" or "[[维基数据]]属性:" .. (result or ""))
		    }}
	return template
end

return p