Content deleted Content added
getValueAndQuals consolidated into getValue |
sync with sandbox |
||
Line 48:
-- some languages, e.g. Bosnian use a period as a suffix after each number in a date
["datenumbersuffix"] = "",
["list separator"] = ", ",
["abbr"] =
{
Line 295 ⟶ 296:
-- any double-quotes " are stripped out, so that spaces may be passed
-- e.g. |sep=" - "
local sepdefault = i18n["
local separator = args.sep or ""
separator = string.gsub(separator, '"', '')
Line 621 ⟶ 622:
-------------------------------------------------------------------------------
-- _getvalue is the common function for getValue, getPreferredValue, and getNormalValue
--
local function _getvalue(frame, entity, props
-- table 'out' is going to to store the return value(s):▼
-- qual is a string containing the property ID of the qualifier(s) to be returned▼
-- if qual == "ALL" then all qualifiers returned▼
-- if qual == "DATES" then qualifiers P580 (start time) and P582 (end time) returned▼
-- if nothing or an empty string is passed set it nil -> no qualifiers returned▼
local qualID = mw.text.trim(frame.args.qual or ""):upper()▼
if qualID == "" then qualID = nil end▼
-- create a filter function
--
-- rank is a parameter passed, which indicates "preferred" or "normal"
--
local rank = (frame.args.rank or ""):lower()
elseif rank:sub(1,1) == "n" then
rank = "normal"
else
rank = ""
end▼
local function filter(claim)▼
end▼
if v.rank == rank then
break▼
end▼
end▼
end▼
local out = propertyvalueandquals(props, frame.args, filter, qualID)
-- format the table of values and return it as a string:
return assembleoutput(out, frame.args, entity.id, propertyID)
Line 652 ⟶ 692:
return errorOrEntity
end
▲ -- qual is a string containing the property ID of the qualifier(s) to be returned
▲ -- if qual == "ALL" then all qualifiers returned
▲ -- if qual == "DATES" then qualifiers P580 (start time) and P582 (end time) returned
▲ -- if nothing or an empty string is passed set it nil -> no qualifiers returned
▲ local qualID = mw.text.trim(frame.args.qual or ""):upper()
▲ if qualID == "" then qualID = nil end
local function filter(claim)
return true
end
return _getvalue(frame, errorOrEntity, props
end
Line 673 ⟶ 706:
--
p.getPreferredValue = function(frame)
return p.getValue(frame)
▲ if not success then
▲ return errorOrEntity
▲ end
▲ local prefflag = false
▲ for k, v in pairs(props) do
▲ if v.rank == "preferred" then
▲ prefflag = true
▲ break
▲ end
▲ end
▲ local function filter(claim)
▲ end
end
Line 699 ⟶ 717:
--
p.getNormalValue = function(frame)
return p.getValue(frame)
▲ end
▲ if v.rank == "normal" then
▲ end
▲ local function filter(claim)
▲ return claim.rank == "normal" or prefflag == false
end
|