-- This module implements the selection of the location map-- in [[Template:Infobox Australian place]] and [[Template:Infobox Australian road]]require('strict')localp={}localfunctionisnotblank(s)returnsands~=''endlocalstatenames={sa='South Australia',vic='Victoria',nsw='New South Wales',qld='Queensland',nt='Northern Territory',wa='Western Australia',tas='Tasmania',act='Australian Capital Territory',jbt='Jervis Bay Territory',ni='Norfolk Island'}localmapwidths={sa=230,qld=190,nt=190,wa=180,tas=210,act=180}functionp.main(frame)locallargs=frame:getParent().argslocalplace_type=(largs.typeor''):lower()localmap_name=largs.map_typeor''localmap_type=(largs.map_typeor'auto'):lower()localstate_abbr=(largs.stateor''):lower()localmap_width=270localcoords=largs.coordinatesor''localcoordsa=largs.coordinates_aor''localcoordsb=largs.coordinates_bor''-- Default for LGAs is nomap-- Default for everywhere else is autoifmap_type==''ormap_type=='auto'thenifplace_type=='lga'thenmap_type='nomap'elsemap_type='auto'endend-- Apply legacy parametersifisnotblank(largs.alternative_location_map)thenmap_type=largs.alternative_location_mapmap_name=map_typeelseifisnotblank(largs.force_national_map)thenmap_type='national'map_name='Australia'elseifisnotblank(largs.use_lga_map)thenmap_type='lga'end-- Process the value in map_typeifmap_type=='state'ormap_type=='auto'ormap_type=='lga'thenmap_name='Australia '..(statenames[state_abbr]or'')map_width=mapwidths[state_abbr]or270ifmap_type=='lga'thenmap_name=map_name..' '..(largs.lgaor'')map_width=mapwidths[state_abbr]or270endelseifmap_type=='national'ormap_type=='australia'thenmap_name='Australia'endifisnotblank(coords)orisnotblank(coordsa)thenelsemap_type='nomap'end-- Finally build the mapifmap_type~='nomap'thenlocalcaption=largs.pushpin_map_captionor''ifcaption~=''thencaption='<div style="font-size: smaller;">'..caption..'</div>'endifisnotblank(coordsa)thenreturnframe:expandTemplate{title='Location map many',args={map_name,relief=largs.reliefor'',label1=isnotblank(coordsb)andisnotblank(largs.direction_a)and(largs.direction_a..' end')or(largs.road_nameor''),coordinates1=coordsa,position1=isnotblank(largs.pushpin_label_position_a)andlargs.pushpin_label_position_aor'left',coordinates2=coordsb,label2=isnotblank(largs.direction_b)and(largs.direction_b..' end')or'',position2=isnotblank(largs.pushpin_label_position_b)andlargs.pushpin_label_position_bor'left',marksize=8,float='center',caption=caption,border='infobox',width=map_width,alt=largs.map_altor''}}endreturnframe:expandTemplate{title='Location map',args={map_name,label=largs.nameor'',relief=largs.reliefor'',coordinates=coords,marksize=6,position=largs.pushpin_label_positionor'',float='center',caption=caption,border='infobox',width=map_width,alt=largs.map_altor''}}endreturn''endreturnp