Zum Inhalt springen

Modul:PropertyLink: Unterschied zwischen den Versionen

40 Bytes hinzugefügt ,  25. Juli 2018
keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 46: Zeile 46:
end
end


function getLabels( propertyName )
function getLabels( frame )
     local entity = mw.wikibase.getEntity('Q29')
propertyName = frame.args[1]
     local entity = mw.wikibase.getEntityObject()
     if not entity or not entity.claims then return end--the entity doesnt exist or have no claims
     if not entity or not entity.claims then return end--the entity doesnt exist or have no claims
     local properties = entity.claims[propertyName]
     local properties = entity.claims[propertyName]
     if not properties then return table.getn(entity.claims) end--no such property for this item
     if not properties then return end--no such property for this item
   
   
     local retVal = 'lol'
     local retVal = ''
     for property in pairs(properties) do
     for propIndex in pairs(properties) do
    local property = properties[propIndex]
local propValue = property.mainsnak.datavalue
local propValue = property.mainsnak.datavalue
if not propValue then return '' end --property doesnt exist
if not propValue then return '' end --property doesnt exist
Zeile 67: Zeile 69:
retVal = value
retVal = value
else
else
retVal = retVal + ', ' + value
retVal = retVal .. ', ' .. value
end
end
end
end
Zeile 76: Zeile 78:
-- Return the label for property, or the label of the linked entiy of that property
-- Return the label for property, or the label of the linked entiy of that property
function label( frame )
function label( frame )
     return getLabel( string.lower(frame.args[1] ))
     return getLabel(string.lower(frame.args[1]))
end
end


11.008

Bearbeitungen

Cookies helfen uns bei der Bereitstellung von Android Wiki. Durch die Nutzung von Android Wiki erklärst du dich damit einverstanden, dass wir Cookies speichern.