Module:Sandbox/ProcrastinatingReader/ib: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 14:
end
 
local function getNetValue(frame, argCategory, argName)
local args = getArgs(frame)
local argType = args['arg_type'] and (args['arg_type']..'_') or ''
local paramName = argCategory..'area__'..argType..argName
 
local net = args[paramName] or dataValue(frame, args['subdivision_name'], paramName, args['name'])
Line 41:
local args = getArgs(frame)
local km2argCategory = getNetValue(frame, 'km2area')
local ha = getNetValue(frame, 'ha')
local acrekm2 = getNetValue(frame, argCategory, 'acrekm2')
local sqmiha = getNetValue(frame, argCategory, 'sq_miha')
local dunamacre = getNetValue(frame, argCategory, 'dunamacre')
local hasqmi = getNetValue(frame, argCategory, 'hasq_mi')
local dunam = getNetValue(frame, argCategory, 'dunam')
if not (isempty(km2) and isempty(ha) and isempty(acre) and isempty(sqmi) and isempty(dunam)) then
Line 62 ⟶ 64:
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)] = '&nbsp;•&nbsp;'..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)
local argTypeparamName = args['arg_typeparam_name']
return getNetValue(frame, argType'area', paramName)
end