Modhul:Wikidata/bakwedhi: Béda antara owahan

Konten dihapus Konten ditambahkan
Tanpa ringkesan besutan
Mbalèkaké owahan 1492583 déning Bennylin (rembugan)
Tenger: Pawurungan
 
Larik 1.110:
return entityId, result
end
 
function p.getParentValues(frame)
local args = frame.args
local id = args.item or frame:getParent().args.item
if id == "" or id == nil then
id = mw.wikibase.getEntityIdForCurrentPage()
if id == nil then return end
end
local languages = findLang(args.lang)
local propertySup = args["property"]; if (propertySup == nil or propertySup == "") then propertySup = "P131" end --administrative entity
local propertyLabel = args["label"]; if (propertyLabel == nil or propertyLabel == "") then propertyLabel = "P31" end --instance
local propertyLink = args["valuetext"]; if propertyLink == "" then propertyLink = nil end --internallink
local upto = args["upto"]; if upto == "" then upto = nil end
local labelShow = args["labelshow"]; if labelShow == "" then labelShow = nil end
local rowformat = args["rowformat"]; if (rowformat == nil or rowformat == "") then rowformat = "$0 = $1" end
local separator = args["separator"]; if (separator == nil or separator == "") then separator = "<br />" end
local sorting = args["sorting"]; if sorting == "" then sorting = nil end
local editicon = not (args.editicon == "false" or args.editicon == "no")
local lastlabel = uc_first(upto or '')
local maxloop = tonumber(upto) or (lastlabel == '' and 10 or 50)
local labelFilter = {}
if labelShow then
for i, v in ipairs(mw.text.split(labelShow, "/")) do
labelFilter[uc_first(v)] = true
end
end
local result = {}
local label, link, linktext
for iter = 1, maxloop do
local label, link
id, link = getPropertyValue(id, propertySup, args.formatting, languages, editicon)
if id then
_, label = getPropertyValue(id, propertyLabel, "label", languages)
if label and link then
if propertyLink then
_, linktext = getPropertyValue(id, propertyLink, "label", languages)
if linktext then
link = mw.ustring.gsub(link, "%[%[(.*)%|(.+)%]%]", "[[%2|" .. linktext .. "]] [[%1|·]]")
end
end
label = case(label, "infoboxlabel", languages[1])
if labelShow == nil or labelFilter[label] then
result[#result + 1] = {label, link}
labelFilter[label] = nil -- only first label found
end
if label == lastlabel then
break
end
else
break
end
else
break
end
end
local ret = {}
local first = 1
local last = #result
local iter = 1
if sorting == "-1" then first = #result; last = 1; iter = -1 end
 
for i = first, last, iter do
local rowtext = mw.ustring.gsub(rowformat, "$[01]", {["$0"] = result[i][1], ["$1"] = result[i][2]})
ret[#ret +1] = expandBraces(rowtext, rowformat)
end
return mw.text.listToText(ret, separator, separator)
end