Module:WikidataIB: Difference between revisions
NeonWabbit (talk | contribs) No edit summary |
NeonWabbit (talk | contribs) No edit summary |
||
| Line 1,114: | Line 1,114: | ||
local unitsymbols = mw.wikibase.getBestStatements(unitqid, "P5061") | local unitsymbols = mw.wikibase.getBestStatements(unitqid, "P5061") | ||
-- construct fallback table, add local lang and multiple languages | -- construct fallback table, add local lang and multiple languages | ||
local fbtbl = mw.language.getFallbacksFor( args.lang ) | local fbtbl = mw.language.getFallbacksFor( args.lang, mw.language.FALLBACK_STRICT ) | ||
table.insert( fbtbl, 1, args.lang ) | table.insert( fbtbl, 1, args.lang ) | ||
table.insert( fbtbl, | table.insert( fbtbl, "mul" ) | ||
table.insert( fbtbl, "en" ) | |||
local found = false | local found = false | ||
for idx1, us in ipairs(unitsymbols) do | for idx1, us in ipairs(unitsymbols) do | ||
| Line 1,125: | Line 1,126: | ||
break | break | ||
end | end | ||
end -- loop through fallback table | |||
if found then break end | if found then break end | ||
end -- loop through values of P5061 | end -- loop through values of P5061 | ||
if found then usep, unit = " ", usym end | if found then usep, unit = " ", usym end | ||
| Line 1,744: | Line 1,745: | ||
local paraset = tonumber(args.ps or args.parameterset or 0) | local paraset = tonumber(args.ps or args.parameterset or 0) | ||
if paraset == 1 then | if paraset == 1 then | ||
-- a common setting | -- a common setting, not usable in infoboxes because the 2018 RFC requires sources | ||
args.rank = "best" | args.rank = "best" | ||
args.fetchwikidata = "ALL" | args.fetchwikidata = "ALL" | ||
| Line 1,750: | Line 1,751: | ||
args.noicon = "true" | args.noicon = "true" | ||
elseif paraset == 2 then | elseif paraset == 2 then | ||
-- equivalent to raw | -- equivalent to raw, not usable in infoboxes because the 2018 RFC requires sources | ||
args.rank = "best" | args.rank = "best" | ||
args.fetchwikidata = "ALL" | args.fetchwikidata = "ALL" | ||
| Line 1,758: | Line 1,759: | ||
args.pd = "true" | args.pd = "true" | ||
elseif paraset == 3 then | elseif paraset == 3 then | ||
-- | -- parameterset 1, but usable in infoboxes because the 2018 RFC requires sources | ||
args.rank = "best" | |||
args.fetchwikidata = "ALL" | |||
args.onlysourced = "yes" | |||
args.noicon = "true" | |||
end | end | ||