Mòdul:Wikidades/proves: diferència entre les revisions

Contingut suprimit Contingut afegit
implementing a max of references
references in table parameters for checking as a number of max refs; hash concatenated with property for ref name
Línia 968:
 
-- see d:Help:Sources
local function getReferences(claim, langparameters)
local lang = parameters.lang
local maxrefs = tonumber(parameters.references) or 1
local notproperref = {
["P143"] = true, -- imported from
Linha 977 ⟶ 979:
local result = {}
-- traverse through all references
local maxrefs = tonumber(parameters.references) or 1
for ref in pairs(claim.references or {}) do
local refparts
Línia 1.086:
end
if refparts then
result[#resultlocal + 1]ref_name = mw.getCurrentFrame():extensionTag("ref", refparts, {name=claim.references[ref].hash}) .. parameters.property
result[#result + 1] = mw.getCurrentFrame():extensionTag("ref", refparts, {name=ref_name})
if maxrefs and maxrefs == #result then break end
end
end
if type(result) == 'table' and #result > 0 and isSet(i18n.categoryref) then
return mw.text.listToText(result) .. "[[" ..i18n.categoryref .. "]]"
end
Linha 1.198 ⟶ 1.199:
local sorting_up = (args.sorting or "") ~= "-1"
local rowformat = args.rowformat
local parameters.references = args.references
local showerrors = args.showerrors
local default = args.default
Linha 1.386 ⟶ 1.387:
if not value and showerrors then value = error end
if value then
if parameters.references and claim.references then reference = claim.references end
refs[#refs]["col0"] = reference
values[#values]["col0"] = value
Linha 1.419 ⟶ 1.420:
for idx in pairs(values) do
local valuerow = values[sortindices[idx]]
local reference = getReferences({["references"] = refs[sortindices[idx]]["col0"]}, parameters.lang)
value = valuerow["col0"]
Linha 1.476 ⟶ 1.477:
local claim = claims[sortindices[1]]
result, result2, error = getValueOfClaim(claim, qualifierId[1], parameters)
if result and parameters.references then result = result .. getReferences(claim, parameters.lang) end
if args.query == 'num' then result_query = 1 end
end