Notice: Template failed integrity check: /home/jvzmxxx/wiki/extensions/MobileFrontend/includes/skins/minerva.mustache in /home/jvzmxxx/wiki/includes/TemplateParser.php on line 121
Zmiany – Czarnobyl Wiki
Otwórz menu główne

Czarnobyl Wiki β

Zmiany

Moduł:Wikidane/select

Dodane 106 bajtów, 20:27, 13 paź 2017
drobne techniczne T178114
if not result or (#result == 0) then
return nil
end
end
return result
end
local function loadClaimsByName(claims)
local result = {}
for k, v in pairs(claims) do
if (type(k) == "string") and k:match"^[Pp]%d%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$" then
local name = mw.wikibase.label(k)
if name and (#name ~= 0) then
result[name] = v
end
end
end
return true
end
 
local function take(sequence, maxCount)
if not maxCount or (type(sequence) ~= "table") or (maxCount < 1) or (#sequence < maxCount) then
return sequence
end
local result = {}
for i = 1, maxCount do
result[i] = sequence[i]
end
return result
end
end,
selectProperty = function(pid, filters, qid, maximumNumberOfItems)
local entity = mw.wikibase.getEntityObject(qid)
if not entity then
if not P then
mw.log(string.format(moduleData.warnPropertyByName, pid))
claims P = loadClaimsByNamemw.wikibase.resolvePropertyId(claimspid) if not P then return pid, false end pid = P
elseif #P == 0 then
pid = "P" .. pid
if #preferred > 0 then
return pid, qid, take(preferred, tonumber(maximumNumberOfItems))
elseif #normal > 0 then
mw.log(string.format(moduleData.warnUsingNormalRank, pid))
return pid, qid, take(normal, tonumber(maximumNumberOfItems))
else
mw.log(string.format(moduleData.warnNoAcceptableRank, pid))
Anonimowy użytkownik