Module:Coordinates: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
m (dummy edit to force a refresh)
(coord2text: Allow lat/long to start with a decimal or a number)
Line 680: Line 680:
frame.args[2] = mw.text.trim(frame.args[2])
frame.args[2] = mw.text.trim(frame.args[2])
if frame.args[2] == 'lat' or frame.args[2] == 'long' then
if frame.args[2] == 'lat' or frame.args[2] == 'long' then
local result, negative = mw.text.split((mw.ustring.match(frame.args[1],'%d+.?%d*°[NS] %d+.?%d*°[EW]') or ''), ' ')
local result, negative = mw.text.split((mw.ustring.match(frame.args[1],'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ')
if frame.args[2] == 'lat' then
if frame.args[2] == 'lat' then
result, negative = result[1], 'S'
result, negative = result[1], 'S'