Module:Titled coords: Difference between revisions

Content deleted Content added
LUA module to generate titled coordinates from WikiData
 
fixed pattern matching on seconds to allow tenths and hundreds (copied from /sandbox)
Line 1:
-- *** Version 1.1 (Alpha) ***
local p = {}
 
Line 18 ⟶ 19:
-- ** See https://www.lua.org/manual/5.3/manual.html#6.4.1 **
sidx, _, lat_d, lat_m, lat_s, lat_NS, lon_d, lon_m, lon_s, lon_WE =
string.find(raw_coords, "(%d+)/(%d+)/(%d+%.?%d?*)/(%a)/(%d+)/(%d+)/(%d+%.?%d?*)/(%a)")
 
if sidx == nil then -- extract without seconds
Line 24 ⟶ 25:
string.find(raw_coords, "(%d+)/(%d+)/(%a)/(%d+)/(%d+)/(%a)")
if sidx == nil then
return output .. "<br/>Error: Failed to process raw_coords: " .. raw_coords
end
if string.find(options,"idx") ~= nil then