Modul:Infobox: Unterschied zwischen den Versionen

1.278 Bytes hinzugefügt ,  5. Mai 2019
renderConnectivity
Keine Bearbeitungszusammenfassung
(renderConnectivity)
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 132: Zeile 132:
     elseif propValue and propValue['type'] == 'string' then
     elseif propValue and propValue['type'] == 'string' then
     return propValue.value
     return propValue.value
else
return ""
end
end
end
function renderSensors()
return renderList('P57')
end
function renderConnectivity()
return renderList('P74')
end
function renderList(claimIdentifier)
local entity = mw.wikibase.getEntityObject()
result = ''
if not entity or not entity.claims then return end --the entity doesnt exist or have no claims
local property = entity.claims[claimIdentifier]
if property then
for key, prop in pairs(property) do
if prop and prop.mainsnak and prop.mainsnak.datavalue then
result = result .. "\n* " .. getValueLabel(prop.mainsnak.datavalue)
end
end
end
return result
end
function renderAmazon(frame)
local entity = mw.wikibase.getEntityObject()
result = ''
if not entity or not entity.claims then return end --the entity doesnt exist or have no claims
local property = entity.claims['P8']
if property and property[1] and property[1].mainsnak and property[1].mainsnak.datavalue then
result = frame:expandTemplate{ title = 'Amazon', args = { getValueLabel(property[1].mainsnak.datavalue), entity:getLabel() .. " bei Amazon" } }
end
return result
end
end


Zeile 163: Zeile 199:
local propValue = prop.mainsnak.datavalue
local propValue = prop.mainsnak.datavalue
result = result .. ", " .. getValue(prop) .. "-Kern";
result = result .. ", " .. getValue(prop) .. "-Kern";
if prop.qualifiers["P32"] and prop.qualifiers["P32"][1] and prop.qualifiers["P32"][1].datavalue then
if prop.qualifiers and prop.qualifiers["P32"] and prop.qualifiers["P32"][1] and prop.qualifiers["P32"][1].datavalue then
result = result .. " " .. getValueLabel(prop.qualifiers["P32"][1].datavalue) .. " CPU"
result = result .. " " .. getValueLabel(prop.qualifiers["P32"][1].datavalue) .. " CPU"
else
result = result .. " unbekannte CPU"
end
end
end
end
Zeile 175: Zeile 213:
return {
return {
     renderAnzeige = renderAnzeige,
     renderAnzeige = renderAnzeige,
     renderCPU = renderCPU
     renderCPU = renderCPU,
    renderSensors = renderSensors,
    renderConnectivity = renderConnectivity,
    renderAmazon = renderAmazon,
}
}
11.008

Bearbeitungen