Module:Sandbox/ProcrastinatingReader/ib

This is an old revision of this page, as edited by ProcrastinatingReader (talk | contribs) at 21:15, 4 December 2020 (proxy). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.nativeName(frame)
	local val = frame.args[1]
	
	if val then
		local match = mw.ustring.match(val, "{{[Ii]nfobox (%a*)")
		--if true then return match end
		if match and match[1] then
			return match[1]
		end
	end
	
	return ""
end

function p.area(frame)
	local args = getArgs(frame)
	
	return frame:expandTemplate{ title = 'infobox_settlement/areadisp', args = {
		['km2'] = args['area_total_km2'],
		['ha'] = args['area_total_ha'],
		['acre'] = args['area_total_acre'],
		['sqmi'] = args['area_total_sq_mi'],
		['dunam'] = args['area_total_dunam'],
		['link'] = args['dunam_link'],
		['pref'] = args['unit_pref'],
		['name'] = args['subdivision_name'],
		['mag'] = args['area_magnitude']
	}}
end

return p