词条 | Module:Sandbox/Redlead07/Wikidata |
释义 | p = {} function p.test(frame) local entityid, propertyid = frame.args.entityid, frame.args.propertyid local statementstbl = mw.wikibase.getBestStatements( entityid, propertyid) local t = {} for k, v in pairs(statementstbl) do local v = v.mainsnak.datavalue.value.id local sitelink = mw.wikibase.getSitelink(v) or "" local a = string.find(sitelink, "%(") or "" local b = string.match(sitelink, "(%w+) (%w+) (%w+) (%w+)") or "" if sitelink == "" then local label = mw.wikibase.getLabel(v) tables = table.insert(t, label) end if sitelink ~= "" and b ~= "" then local display_text = mw.wikibase.getLabel(v) local statement = ""..display_text.."" tables = table.insert(t, statement) end if sitelink ~= "" and a ~= "" and b == "" then local sitelink = ""..mw.wikibase.getSitelink(v).."" local display_text = sitelink:gsub( '%b()', ) local statement = ""..display_text.."" tables = table.insert(t, statement) end if sitelink ~= "" and a == "" and b == "" then local statement = ""..sitelink.."" tables = table.insert(t, statement) end
end
return table.concat(t, "
end return p |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。