retval = retval .. '<div><div></div>' .. args.caption .. '</div>'
end  
if args.switcherLabel then
retval = retval .. '<span>' .. args.switcherLabel .. '</span>'
elseif args.autoSwitcherLabel then
retval = retval .. '<span>வரைபடத்தைக் காட்டுக: ' .. map('name') .. '</span>'
end  
retval = retval .. '</div></div>'
if args.caption_undefined then
mw.log('Removed parameter caption_undefined used.')
local parent = :getParent
if parent then
mw.log('Parent is ' .. parent:getTitle)
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
retval = retval .. ''
end
end
if map('skew') ~= * or map('lat_skew') ~= * or map('crosses180') ~= * or map('type') ~= * then
mw.log('Removed parameter used in map definition ' .. map)
if currentTitle.namespace == 0 then
local key = (map('skew') ~= * and 'skew' or *) ..
(map('lat_skew') ~= * and 'lat_skew' or *) ..
(map('crosses180') ~= * and 'crosses180' or *) ..
(map('type') ~= * and 'type' or *)
retval = retval .. ''
end
end
if string.find(map('name'), '|', 1, true) then
mw.log('Pipe used in name of map definition ' .. map)
if currentTitle.namespace == 0 then
retval = retval .. ''
end
end
if args.float == '' then
retval = retval .. '</div>'
end
return retval
end  
local function markOuterDiv(x, y, imageDiv, labelDiv, label_size)
return mw.html.create('div')
:addClass('od')
:addClass('notheme') -- T236137
:cssText('top:' .. round(y, 3) .. '%;:' .. round(x, 3) .. '%;font-size:' .. label_size .. '%')
:node(imageDiv)
:node(labelDiv)
end  
local function markImageDiv(mark, marksize, label, link, alt, title)
local builder = mw.html.create('div')
:addClass('id')
:cssText(':-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px')
:attr('title', title)
if marksize ~= 0 then
builder:wikitext(string.format(
'',
mark,
marksize,
marksize,
label,
link,
alt and ('|alt=' .. alt) or ''
))
end
return builder
end  
local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)
if tonumber(label_size) == 0 then
return mw.html.create('div'):addClass('l0'):wikitext(label)
end
local builder = mw.html.create('div')
:cssText('width:' .. label_width .. 'em')
local distance = round(marksize / 2 + 1)
if position == 'top' then -- specified top
builder:addClass('pv'):cssText('bottom:' .. distance .. 'px;:' .. (-label_width / 2) .. 'em')
elseif position == 'bottom' then -- specified bottom
builder:addClass('pv'):cssText('top:' .. distance .. 'px;:' .. (-label_width / 2) .. 'em')
elseif position == * or (tonumber(x) > 70 and position ~= *) then -- specified or autodetected to
builder:addClass('pl'):cssText(':' .. distance .. 'px')
else -- specified or autodetected to
builder:addClass('pr'):cssText(':' .. distance .. 'px')
end
builder = builder:tag('div')
:wikitext(label)
if background then
builder:cssText('background-color:' .. background)
end
return builder:done
end  
local function getX(longitude, , )
local width = ( - ) % 360
if width == 0 then
width = 360
end
local distanceFromLeft = (longitude - ) % 360
-- the distance needed past the map to the equals distanceFromLeft - width. the distance needed past the map to the equals 360 - distanceFromLeft. to minimize page stretching, go whichever way is shorter
if distanceFromLeft - width / 2 >= 180 then
distanceFromLeft = distanceFromLeft - 360
end
return 100 * distanceFromLeft / width
end  
local function getY(latitude, top, bottom)
return 100 * (top - latitude) / (top - bottom)
end  
function p.mark(, args, map)
if not args then
args = getArgs(, {wrappers = 'Template:Location map~'})
end
local mapnames = {}
if not map then
if args[1] then
map = {}
for mapname in mw.text.gsplit(args[1], '#', true) do
map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), )
mapnames[#mapnames + 1] = mapname
end
if #map == 1 then map = map[1] end
else
map = p.getMapParams('World', )
args[1] = 'World'
end
end
if type(map) == 'table' then
local outputs = {}
local oldargs = args[1]
for k,v in ipairs(map) do
args[1] = mapnames[k]
outputs[k] = tostring(p.mark(, args, v))
end
args[1] = oldargs
return table.concat(outputs, '#PlaceList#') .. '#PlaceList#'
end
local x, y, longitude, latitude
longitude = decdeg(args.lon_deg, args.lon_min, args.lon_sec, args.lon_dir, args.long, 'longitude')
latitude = decdeg(args.lat_deg, args.lat_min, args.lat_sec, args.lat_dir, args.lat, 'latitude')
if args.excludefrom then
-- If this mark is to be excluded from certain maps entirely (useful in the context of multiple maps)
for exclusionmap in mw.text.gsplit(args.excludefrom, '#', true) do
-- Check if this map is excluded. If so, return an empty string.
if args[1] == exclusionmap then
return ''
end
end  
end
local builder = mw.html.create
local currentTitle = mw.title.getCurrentTitle
if args.coordinates then
-- Temporarily removed to facilitate infobox conversion. See  
-- if longitude or latitude then
-- error('Coordinates from Module:Coordinates and individual coordinates cannot both be provided')
-- end
longitude = coord2text('longitude', args.coordinates)
latitude = coord2text('latitude', args.coordinates)
elseif not longitude and not latitude and args.useWikidata then
-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.
local entity = mw.wikibase.getEntity
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then
local value = entity.claims.P625[1].mainsnak.datavalue.value
longitude, latitude = value.longitude, value.latitude
end
if args.link and (currentTitle.namespace == 0) then
builder:wikitext('')
end
end
if not longitude then
error('No value was provided for longitude')
elseif not latitude then
error('No value was provided for latitude')
end
if currentTitle.namespace > 0 then
if (not args.lon_deg) ~= (not args.lat_deg) then
builder:wikitext('')
elseif (not args.lon_min) ~= (not args.lat_min) then
builder:wikitext('')
elseif (not args.lon_sec) ~= (not args.lat_sec) then
builder:wikitext('')
elseif (not args.lon_dir) ~= (not args.lat_dir) then
builder:wikitext('')
elseif (not args.long) ~= (not args.lat) then
builder:wikitext('')
end
end
if ((tonumber(args.lat_deg) or 0) < 0) and ((tonumber(args.lat_min) or 0) ~= 0 or (tonumber(args.lat_sec) or 0) ~= 0 or (args.lat_dir and args.lat_dir ~='')) then
builder:wikitext('')
end
if ((tonumber(args.lon_deg) or 0) < 0) and ((tonumber(args.lon_min) or 0) ~= 0 or (tonumber(args.lon_sec) or 0) ~= 0 or (args.lon_dir and args.lon_dir ~= '')) then
builder:wikitext('')
end
if (((tonumber(args.lat_min) or 0) < 0) or ((tonumber(args.lat_sec) or 0) < 0)) then
builder:wikitext('')
end
if (((tonumber(args.lon_min) or 0) < 0) or ((tonumber(args.lon_sec) or 0) < 0)) then
builder:wikitext('')
end
if args.skew or args.lon_shift or args.markhigh then
mw.log('Removed parameter used in invocation.')
local parent = :getParent
if parent then
mw.log('Parent is ' .. parent:getTitle)
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
local key = (args.skew and 'skew' or '') ..
(args.lon_shift and 'lon_shift' or '') ..
(args.markhigh and 'markhigh' or '')
builder:wikitext('')
end
end
if map('x') ~= '' then
x = tonumber(mw.ext.ParserFunctions.expr(map('x', { latitude, longitude })))
else
x = tonumber(getX(longitude, map(*), map(*)))
end
if map('y') ~= '' then
y = tonumber(mw.ext.ParserFunctions.expr(map('y', { latitude, longitude })))
else
y = tonumber(getY(latitude, map('top'), map('bottom')))
end
if (x < 0 or x > 100 or y < 0 or y > 100) and not args.outside then
mw.log('Mark placed outside map boundaries without outside flag set. x = ' .. x .. ', y = ' .. y)
local parent = :getParent
if parent then
mw.log('Parent is ' .. parent:getTitle)
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
local key = currentTitle.prefixedText
builder:wikitext('')
end
end
local mark = args.mark or map('mark')
if mark == '' then
mark = 'Red pog.svg'
end