Modul:Political party/peskovnik2
Videz
Mogoče bi radi ustvarili dokumentacijsko stran za ta Scribunto modul Urejevalci lahko preizkušate ta modul v peskovniku (ustvari | mirror) in testnihprimerih (ustvari). Prosimo, da dodate kategorije v /dok podstran. Podstrani te predloge. |
local p = {}
function p.getProperty(frame)
local title = frame.args[1] -- Page name passed as argument
local entityId = mw.wikibase.getEntityIdForTitle(title) -- Get the entity ID for the given page title
if not entityId then
return "No Wikidata item found for this page"
end
local entity = mw.wikibase.getEntity(entityId) -- Get the entity object using the entity ID
if not entity then
return "No Wikidata entity found for ID " .. entityId
end
local propertyId = "P465"
local claims = entity.claims[propertyId]
if not claims then
return "No value found for property P465 for entity " .. entityId
end
local propertyValue = claims[1].mainsnak.datavalue.value -- Get the value of property P465
return "Wikidata ID: " .. entityId .. ", Property P465: " .. tostring(propertyValue)
end
return p