Mòdul:Wikidades: diferència entre les revisions
Contingut suprimit Contingut afegit
version 20201119 |
getParentValues: unificació upto/uptolabelid i labelshow/showlabelid, corr. include_self |
||
Línia 1:
-- version
local p = {}
Línia 1.474:
local function uc_first(word)
return mw.ustring.upper(mw.ustring.sub(word, 1, 1)) .. mw.ustring.sub(word, 2)
end
Linha 1.501 ⟶ 1.502:
propertyLabel,
propertyLink,
label_show,
labelicon0,
labelicon1,
Linha 1.511 ⟶ 1.512:
include_self)
▲ if upto_value == nil then upto_value = "" end
local upto_link_ids = {}▼
upto_link_ids[resolveEntityId(q)] = true▼
end▼
local propertySups = mw.text.split(propertySupString, '[^P%d]')
local
maxloop = tonumber(upto_number)
elseif next(upto_label) or next(upto_value) then
local labelFilter = {}▼
maxloop = 50
▲ if labelShow then
for _, v in ipairs(mw.text.split(labelShow, "/")) do▼
labelFilter[uc_first(v)] = true▼
end▼
end
local labels_filter = next(label_show)
local label_self▼
_, label_self = getPropertyValue(id, propertyLabel, label_format, languages)▼
local result = {}
local id_value = id
for iter = 1, maxloop do
local link, label, labelwicon, linktext,
for _, propertySup in pairs(propertySups) do
if
end
if not
if propertyLink then
_, linktext = getPropertyValue(
if linktext then
link = mw.ustring.gsub(link, "%[%[(.*)%|.+%]%]", "[[%1|" .. linktext .. "]]")
Linha 1.549 ⟶ 1.541:
end
if labelicon0 then
_, labelwicon = getPropertyValue(
else
labelwicon = label
end
if
result[#result + 1] = {labelwicon, link}
if label then▼
▲ labelFilter[label] = nil -- only first label found
end▼
end
if
break
end
Linha 1.573 ⟶ 1.562:
end
if include_self then
▲
table.insert(result, 1, {label_self, link_self})
▲ end
return result
Linha 1.624 ⟶ 1.618:
local upto_number = getArg(args.upto)
local last_only = getArg(args.last_only, false)
local editicon, labelicon = setIcons(args.editicon, pargs.editicon)
local include_self = getArg(args.include_self, false)
local case = getArg(args.case)
local upto_label = {}
if checked_q then
elseif type(upto_number) == 'string' then▼
upto_label[checked_q] =
▲ end
end
upto_label[uc_first(upto_number)] = true
upto_number = nil
require(wiki.module_title .. '/debug').track('upto') -- replace upto by uptolabelid
end
local checked_q = resolveEntityId(q)
for substring in mw.text.gsplit(args.showlabelid, '[^Q%d]') do▼
if checked_q then
▲ table.insert(showLabelList, (getLabelByLangs(substring, languages)))
upto_value[checked_q] = true
end
end
local checked_q = resolveEntityId(q)
if checked_q then
label_show[checked_q] = true
end
require(wiki.module_title .. '/debug').track('labelshow') -- replace labelshow by showlabelid
end
end
Linha 1.661 ⟶ 1.670:
propertyLabel,
propertyLink,
labelicon0,
labelicon1,
upto_number,
upto_label,
upto_value,
▲ args.uptovalueid or args.uptolinkid,
last_only,
case,
Linha 1.753 ⟶ 1.762:
local function getBestValue(id, prop)
end
|