"मोड्युल:Coordinates" के अवतरणसभमे अन्तर

Content deleted Content added
Updating
Update per enwiki
पङ्क्त्ति ७१४:
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end
end
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'Docdoc' and page_title.subpageText ~= 'परीक्षण पृष्ठ' then args[10] = 'primary' end
args.notes, args.format, args.display = nil
text = text .. coord_wrapper(args)
पङ्क्त्ति ७३१:
{{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}
 
Valid values for the second parameter are strings: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source
 
]]
function coordinates.coord2text(frame)
localif coordframe.args[1] == mw.text.trim('' or frame.args[12] or== '') or not frame.args[2] then return nil end
local paramframe.args[2] = mw.text.trim(frame.args[2] or '')
if coordframe.args[2] == 'lat' or paramframe.args[2] == 'long' then return nil end
local result, negative = mw.text.split((mw.ustring.match(frame.args[1],'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ')
coord = translate2en(coord)
if paramframe.args[2] == 'lat' or param == 'long' then
result, negative = result[1], 'S'
local value, direction, long, ew = coord:match('(%-?[.%d]+)°([NS]) (%-?[.%d]+)°([EW])')
else
if param == 'long' then value, direction = long, ew end
result, negative = result[2], 'W'
value = tonumber(value)
if value then
if direction == 'S' or direction == 'W' then value = -value end
return tostring(value)
end
result = mw.text.split(result, '°')
return nil
if result[2] == negative then result[1] = '-'..result[1] end
return nilresult[1]
else
return coord:mw.ustring.match(frame.args[1], 'params=.-_'..paramframe.args[2]..':(.-)[ _]')
end
end