Content deleted Content added
m Protected "Module:PrevalenceData": Highly visible template ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) |
catch pages that have no connected WIkidata entity |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1:
local p = {}
p.main = function ( frame )
if
-- Run through all prevalence claims - the table prevalenceClaims always exists but may be empty
▲ local pRange = ''
if string.len( pRange ) > 0 then
▲ local prevalenceValue = prevalenceClaim.mainsnak.datavalue.value
▲ if prevalenceValue then
▲ -- Split multiple claims
▲ -- Maybe line break instead?
local lowerBound = prevalenceValue.lowerBound * 100
pRange = pRange .. ', '▼
local upperBound = prevalenceValue.upperBound * 100
end▼
pRange = pRange ..
end
▲ if lowerBound ~= upperBound then
pRange = pRange .. ' to ' .. upperBound▼
local amount = prevalenceValue.amount * 100
▲ end
pRange = pRange .. amount
end
pRange = pRange .. '%' local qualId = qual.datavalue.value[ 'numeric-id' ]▼
local link = mw.wikibase.sitelink( 'Q' .. qualId )▼
local label = ({▼
-- Certain geographic locales might need a▼
-- manual-ish override for labels. ▼
[ 132453 ] = 'developed world'▼
})[ qualId ] or mw.wikibase.label( 'Q' .. qualId )▼
if link then▼
label = '[[' .. link .. '|' .. label .. ']]'▼
▲ pRange = pRange .. label
end
▲ end
end
end
--[[▼
-- Todo: References▼
if prevalenceClaim.references then ▼
▲ end
end
end
end
end
return
end
|