Module:Australian place map/sandbox explained

-- This module implements the selection of the location map-- in and require('strict')local p =

local function isnotblank(s) return s and s ~= end

local statenames = local mapwidths =

function p.main(frame) local largs = frame:getParent.args local place_type = (largs.type or ):lower local map_name = largs.map_type or local map_type = (largs.map_type or 'auto'):lower local state_abbr = (largs.state or ):lower local map_width = 270 local coords = largs.coordinates or local coordsa = largs.coordinates_a or local coordsb = largs.coordinates_b or -- Default for LGAs is nomap -- Default for everywhere else is auto if map_type

or map_type

'auto' then if place_type

'lga' then map_type = 'nomap' else map_type = 'auto' end end -- Apply legacy parameters if isnotblank(largs.alternative_location_map) then map_type = largs.alternative_location_map map_name = map_type elseif isnotblank(largs.force_national_map) then map_type = 'national' map_name = 'Australia' elseif isnotblank(largs.use_lga_map) then map_type = 'lga' end -- Process the value in map_type if map_type

'state' or map_type

'auto' or map_type

'lga' then map_name = 'Australia ' .. (statenames[state_abbr] or ) map_width = mapwidths[state_abbr] or 270 if map_type

'lga' then map_name = map_name .. ' ' .. (largs.lga or ) map_width = mapwidths[state_abbr] or 270 end elseif map_type

'national' or map_type

'australia' then map_name = 'Australia' end if isnotblank(coords) or isnotblank(coordsa) then else map_type = 'nomap' end -- Finally build the map if map_type ~= 'nomap' then local caption = largs.pushpin_map_caption or if caption ~= then caption = '' .. caption .. '' end if isnotblank(coordsa) then return frame:expandTemplate end return frame:expandTemplate end return end

return p