Nicht angemeldeter Benutzer - Bearbeiten von Seiten ist nur als angemeldeter Benutzer möglich.

Änderungen

Zur Navigation springen Zur Suche springen
283 Bytes hinzugefügt ,  19:28, 27. Aug. 2017
K
keine Bearbeitungszusammenfassung
Zeile 631: Zeile 631:  
local inverse = frame.args["inverse"]
 
local inverse = frame.args["inverse"]
 
local showerrors = frame.args["showerrors"]
 
local showerrors = frame.args["showerrors"]
local default = frame.args["default"] or ""
+
local default = frame.args["default"]
if default ~="" then showerrors = nil end
+
if default then showerrors = nil end
    
-- get wikidata entity
 
-- get wikidata entity
Zeile 660: Zeile 660:  
-- sort by time qualifier
 
-- sort by time qualifier
 
comparator = function(a, b)
 
comparator = function(a, b)
local timea = getQualifierSortValue(claims[a], sort) or ''
+
local timea = getQualifierSortValue(claims[a], sort)
local timeb = getQualifierSortValue(claims[b], sort) or ''
+
local timeb = getQualifierSortValue(claims[b], sort)
 
if type(timea) ~= type(timeb) and not (tonumber(timea) and tonumber(timeb)) then
 
if type(timea) ~= type(timeb) and not (tonumber(timea) and tonumber(timeb)) then
 
if tonumber(timea) then return true
 
if tonumber(timea) then return true
elseif tonumber(timeb) then return ""
+
elseif tonumber(timeb) then return false
 
elseif tostring(timea) and tostring(timeb) then
 
elseif tostring(timea) and tostring(timeb) then
 
if inverse then return tostring(timea) > tostring(timeb) else return tostring(timea) < tostring(timeb) end
 
if inverse then return tostring(timea) > tostring(timeb) else return tostring(timea) < tostring(timeb) end
else return "" end -- different types, neither numbers nor strings, no chance to compare => random result to avoid script error
+
else return false end -- different types, neither numbers nor strings, no chance to compare => random result to avoid script error
 
elseif tonumber(timea) and tonumber(timeb) then
 
elseif tonumber(timea) and tonumber(timeb) then
 
timea = tonumber(timea)
 
timea = tonumber(timea)
Zeile 673: Zeile 673:  
end
 
end
 
if inverse then
 
if inverse then
return tostring(timea > timeb) or ""
+
return timea > timeb
 
else
 
else
return tostring(timea < timeb) or ""
+
return timea < timeb
 
end
 
end
 
end
 
end
Zeile 696: Zeile 696:  
comparator = function(a, b)
 
comparator = function(a, b)
 
if inverse then
 
if inverse then
return tostring(sortkeys[a] > sortkeys [b]) or ""
+
return sortkeys[a] > sortkeys [b]
 
else
 
else
return tostring(sortkeys[a] < sortkeys [b]) or ""
+
return sortkeys[a] < sortkeys [b]
 
end
 
end
 
end
 
end
Zeile 755: Zeile 755:     
if result then return result else
 
if result then return result else
if showerrors then return error else return tostring(default) or "" end
+
if showerrors then return error else return default end
 
end
 
end
 
end
 
end
Zeile 761: Zeile 761:  
function p.getValue(frame)
 
function p.getValue(frame)
 
local param = frame.args[2]
 
local param = frame.args[2]
if param == "FETCH_WIKIDATA" or param == i18n["FETCH_WIKIDATA"] then return tostring(p.claim(frame)) or "" else return tostring(param) or "" end
+
if param == "FETCH_WIKIDATA" or param == i18n["FETCH_WIKIDATA"] then return p.claim(frame) else return param end
 
end
 
end
   Zeile 767: Zeile 767:  
local id = frame.args[1]
 
local id = frame.args[1]
 
local entity = mw.wikibase.getEntity(id)
 
local entity = mw.wikibase.getEntity(id)
if not entity then return "" else return entity.id end
+
-- if not entity then return "" else return entity.id end    --    revert, wegen Einspruchs:
 +
if not entity then return nil else return entity.id end
 
end
 
end
   Zeile 806: Zeile 807:  
if result then result = result .. "/" .. badges[idx] else result = badges[idx] end
 
if result then result = result .. "/" .. badges[idx] else result = badges[idx] end
 
end
 
end
return tostring(result) or ""
+
-- return tostring(result) or ""   --  Revert wegen Einspruchs:
 +
return result
 
end
 
end
 
end
 
end
Zeile 821: Zeile 823:  
end
 
end
 
end
 
end
return tostring(count) or ""
+
-- return tostring(count) or ""       -- Revert wegen Einspruchs:
 +
return count
 
end
 
end
   Zeile 839: Zeile 842:  
frame.args = newargs
 
frame.args = newargs
 
local status, result = pcall(p[func], frame)
 
local status, result = pcall(p[func], frame)
if status then return tostring(result) or "" else return '<span class="error">' .. result .. '</span>' end
+
-- if status then return tostring(result) or "" else return '<span class="error">' .. result .. '</span>' end -- revert
 +
if status then return result else return '<span class="error">' .. result .. '</span>' end
 
else
 
else
 
return printError("invalid-parameters")
 
return printError("invalid-parameters")
Zeile 848: Zeile 852:  
local id = frame.args[1]
 
local id = frame.args[1]
 
local entity = mw.wikibase.getEntity(id)
 
local entity = mw.wikibase.getEntity(id)
 +
--[=[
 
if entity then
 
if entity then
 
return "<pre>" .. mw.text.jsonEncode(entity, mw.text.JSON_PRETTY) .. "</pre>"
 
return "<pre>" .. mw.text.jsonEncode(entity, mw.text.JSON_PRETTY) .. "</pre>"
 
else
 
else
 
return ""
 
return ""
end
+
end ]=]
 +
if entity then return "<pre>" .. mw.text.jsonEncode(entity, mw.text.JSON_PRETTY) .. "</pre>" end
 
end
 
end
    
return p
 
return p
Anonymer Benutzer
Cookies helfen uns bei der Bereitstellung von imedwiki. Durch die Nutzung von imedwiki erklärst du dich damit einverstanden, dass wir Cookies speichern.

Navigationsmenü