Module:Solar eclipse: Difference between revisions

Content deleted Content added
No edit summary
add coordinates
Line 24:
local success, result = pcall(lang.formatDate, lang, 'F j, Y', y .. '-' .. m .. '-' .. d)
return success and result or nil
end
 
local function parsecoord(frame, s)
local lat = s:match('^%s*([%d][%d.]*)%s*[NS]%s*[%d][%d.]*[EW]%s*$')
local NS = s:match('^%s*[%d][%d.]*%s*([NS])%s*[%d][%d.]*[EW]%s*$')
local lon = s:match('^%s*[%d][%d.]*%s*[NS]%s*([%d][%d.]*)[EW]%s*$')
local EW = s:match('^%s*[%d][%d.]*%s*[NS]%s*[%d][%d.]*([EW])%s*$')
if( lat and NS and lon and EW ) then
return frame:expandTemplate{ title = 'coord', args = {lat, NS, lon, EW, 'type:landmark'} }
else
return s
end
end
 
Line 36 ⟶ 48:
end
 
local function loadsolardb(frame, s)
local yearstr = s:match('^%s*([%d][%d][%d][%d])[A-Z][a-z][a-z][%d][%d]%s*$') or ''
local function setarg(k, v)
Line 63 ⟶ 75:
setarg('duration', dargs['Dur'])
setarg('___location', '')
setarg('coords', parsecoord(frame,dargs['Loc']))
setarg('max_width', dargs['Wid'] and dargs['Wid'] .. ' km')
setarg('times_ref', '')
Line 155 ⟶ 167:
 
if( args['2'] and args['2'] ~= '') then
loadsolardb(frame,args['2'])
elseif( args['1'] and args['1'] ~= '') then
loadsolardb(frame,args['1'])
end