Zum Inhalt springen

Modul:PropertyLink: Unterschied zwischen den Versionen

780 Bytes hinzugefügt ,  25. Juli 2018
keine Bearbeitungszusammenfassung
(Nutze enwiki oder dewiki Link, wenn verfügbar)
Keine Bearbeitungszusammenfassung
Zeile 28: Zeile 28:
     return getProperty(string.upper(frame.args[1]))
     return getProperty(string.upper(frame.args[1]))
end
end
 
function getLabel( propertyName )
function getLabel( propertyName )
     local entity = mw.wikibase.getEntity()
     local entity = mw.wikibase.getEntity()
Zeile 45: Zeile 45:
     end
     end
end
end
function getLabels( propertyName )
    local entity = mw.wikibase.getEntity()
    if not entity or not entity.claims then return end--the entity doesnt exist or have no claims
    local properties = entity.claims[propertyName]
    if not properties then return end--no such property for this item
   
   
    local retVal = ''
    for property in pairs(properties) do
local propValue = property.mainsnak.datavalue
if not propValue then return '' end --property doesnt exist
local value
if propValue['type']=='wikibase-entityid' then
value = mw.wikibase.label( "Q" ..propValue.value['numeric-id'] )
elseif propValue['type'] == 'string' then
value = propValue.value
end
if retVal == '' then
retval = value
else
retval = retval + ', ' + value
end
end
end
-- 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 )
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.