יחידה:PropertyLink: הבדלים בין גרסאות בדף
יצירת דף עם התוכן "local p = {} function p.property(frame) entity = mw.wikibase.getEntity() property = entity.claims[frame.args[1]] propValue = property.ma..." |
מאין תקציר עריכה |
||
| שורה 3: | שורה 3: | ||
function p.property(frame) | function p.property(frame) | ||
entity = mw.wikibase.getEntity() | entity = mw.wikibase.getEntity() | ||
if entity == nil then | |||
return "Entity not found" | |||
end | |||
property = entity.claims[frame.args[1]] | property = entity.claims[frame.args[1]] | ||
if property == nil then | |||
return "property not found" | |||
end | |||
propValue = property.mainsnak.datavalue | propValue = property.mainsnak.datavalue | ||
if propValue ==nil then | |||
return "property value not found" | |||
end | |||
if propValue['type']=='wikibase-entityid' then | if propValue['type']=='wikibase-entityid' then | ||
return '[['+mw.wikibase.sitelink(propValue.value['numeric-id'])+'|'+mw.wikibase.getLabel(propValue.value['numeric-id'])']]' | return '[['+mw.wikibase.sitelink(propValue.value['numeric-id'])+'|'+mw.wikibase.getLabel(propValue.value['numeric-id'])']]' | ||