Content deleted Content added
+ |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 2:
local p = {}
local function isempty(s)
return s == nil or s == ''
end
local function dataValue(frame, settlementName, parameterName, itemName)
Line 10 ⟶ 14:
end
local function getNetValue(frame,
local args = getArgs(frame)
local
local paramName = argCategory..'_'..argType..argName
local net = args[paramName] or dataValue(frame, args['subdivision_name'], paramName, args['name'])
return net
end
Line 32 ⟶ 40:
function p.area(frame)
local args = getArgs(frame)
local argType = args['arg_type']▼
local argCategory = 'area'
return frame:expandTemplate{ title = 'infobox_settlement/areadisp', args = {▼
['ha'] = args['area_'..argType..'_ha'],▼
local ha = getNetValue(frame, argCategory, 'ha')
local acre = getNetValue(frame, argCategory, 'acre')
local sqmi = getNetValue(frame, argCategory, 'sq_mi')
local dunam = getNetValue(frame, argCategory, 'dunam')
['link'] = args['dunam_link'],▼
['pref'] = args['unit_pref'],▼
if not (isempty(km2) and isempty(ha) and isempty(acre) and isempty(sqmi) and isempty(dunam)) then
['name'] = args['subdivision_name'],▼
['km2'] = km2,
}}▼
['ha'] = ha,
['acre'] = acre,
['sqmi'] = sqmi,
['dunam'] = dunam,
}}
else
return ""
end
end
function p.demographics(frame)
local args = getArgs(frame)
local tArgs = {
['child'] = 'yes',
['headerstyle'] = 'text-align:left',
for i = 1,2 do
local dtype = getNetValue(frame, 'demographics', 'type'..i)
if not isempty(dtype) then
local series = i + 20 * (i-1)
tArgs['header'..series] = dtype..'<div style="font-weight:normal;display:inline;">'.. getNetValue(frame, 'demographics1', 'footnotes') ..'</div>'
tArgs['rowclass'..series] = 'mergedtoprow'
for j = 1,10 do
local dval = getNetValue(frame, 'demographics1', 'title'..j)
if not isempty(dval) then
tArgs['rowclass'..(series + j)] = 'mergedrow'
tArgs['label'..(series + j)] = ' • '..getNetValue(frame, 'demographics1', 'title'..j)
tArgs['data'..(series + j)] = getNetValue(frame, 'demographics1', 'info'..j)
end
end
end
end
return frame:expandTemplate{ title = 'infobox', args = tArgs}
end
function p.generic(frame)
local args = getArgs(frame)
return getNetValue(frame, 'area', paramName)
end
|