Anonymous user
Module:Coordinates: Difference between revisions
mal-synced? backout per issue noted at Grade I listed buildings in Dorset, getting "cannot have more than one primary tag per page"
(sandbox sync per TPER at talk, bring #coordinates to module) |
(mal-synced? backout per issue noted at Grade I listed buildings in Dorset, getting "cannot have more than one primary tag per page") |
||
Line 51:
wrappers = 'Template:Coord'
})
return coordinates[funcName](args
end
end
Line 309:
parseDec
Transforms decimal format latitude and longitude into the a
structure to be used in displaying coordinates
]]
Line 346:
]]
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )
local coordinateSpec
lat_f = lat_f:upper();
Line 353 ⟶ 354:
-- Check if specified backward
if lat_f == 'E' or lat_f == 'W' then
local t_d, t_m, t_s, t_f;
t_d = lat_d;
t_m = lat_m;
t_s = lat_s;
t_f = lat_f;
lat_d = long_d;
lat_m = long_m;
lat_s = long_s;
lat_f = long_f;
long_d = t_d;
long_m = t_m;
long_s = t_s;
long_f = t_f;
end
Line 387 ⟶ 400:
end
return coordinateSpec, errors
end
Line 396 ⟶ 409:
local function formatTest(args)
local result, errors
local
local function getParam(args, lim)
Line 421 ⟶ 434:
elseif dmsTest(args[4], args[8]) then
-- dms logic
result, errors
args[5], args[6], args[7], args[8], args.format)
if args[10] then
Line 432 ⟶ 445:
elseif dmsTest(args[3], args[6]) then
-- dm logic
result, errors
args[4], args[5], nil, args[6], args['format'])
if args[8] then
Line 443 ⟶ 456:
elseif dmsTest(args[2], args[4]) then
-- d logic
result, errors
args[3], nil, nil, args[4], args.format)
if args[6] then
Line 469 ⟶ 482:
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'
end
return ret
end
Line 615 ⟶ 628:
end
local contents
local Notes = args.notes or ''
local Display = args.display and args.display:lower() or 'inline'
Line 626 ⟶ 639:
-- Finds whether coordinates are displayed in the title.
return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'
end
Line 641 ⟶ 649:
.. displaytitle(contents, Notes)
.. makeWikidataCategories()
▲ local tmp = {}
end
return text
Line 707 ⟶ 700:
for i, v in ipairs(frame.args) do
if i ~= 1 then
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ', 1) end
end
end
|