Modul:Location map: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Hidayatsrf (bicara | kontrib) update; gunakan Module:Location map/styles.css |
-require('Module:No globals') |
||
(8 revisi perantara oleh 2 pengguna tidak ditampilkan) | |||
Baris 1:
local p = {}
Baris 12 ⟶ 10:
function p.getMapParams(map, frame)
if not map then
error('
end
local moduletitle = mw.title.new('Module:Location map/data/' .. map)
if not moduletitle then
error(string.format('%q
elseif moduletitle.exists then
local mapData = mw.loadData('Module:Location map/data/' .. map)
Baris 28 ⟶ 26:
else
return mapData[name]
end
end
elseif mw.title.new('Templat:Location map ' .. map).exists then
local cache = {}
if type(frame) ~= 'table' or type(frame.expandTemplate) ~= 'function' then
error('Frame harus disediakan saat menggunakan peta lokasi lama')
end
return function(name, params)
if params then
return frame:expandTemplate{title = 'Location map ' .. map, args = { name, unpack(params) }}
else
if name == nil then
return 'Templat:Location map ' .. map
elseif cache[name] == nil then
cache[name] = frame:expandTemplate{title = 'Location map ' .. map, args = { name }}
end
return cache[name]
end
end
else
error('
end
end
Baris 59 ⟶ 74:
if decimal then
if degrees then
error('
elseif minutes then
error('
elseif seconds then
error('
elseif hemisphere then
error('
end
local retval = tonumber(decimal)
Baris 71 ⟶ 86:
return retval
end
error('
elseif seconds and not minutes then
error('
elseif not degrees then
if minutes then
error('
elseif hemisphere then
error('
end
return nil
Baris 84 ⟶ 99:
decimal = tonumber(degrees)
if not decimal then
error('
elseif minutes and not tonumber(minutes) then
error('
elseif seconds and not tonumber(seconds) then
error('
end
decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600
Baris 94 ⟶ 109:
local multiplier = hemisphereMultipliers[direction][hemisphere]
if not multiplier then
error('
end
decimal = decimal * multiplier
Baris 113 ⟶ 128:
mw.logObject(para, 'para')
mw.logObject(coord, 'coord')
return error('
end
return tonumber(result[1]) * hemisphereMultipliers[para][result[2]]
Baris 211 ⟶ 226:
image,
width,
args.alt or ((args.label or currentTitle.text) .. '
args.maplink and ('|link=' .. args.maplink) or ''
)
if args.caption and args.caption ~= '' then
if (currentTitle.namespace == 0) and mw.ustring.find(args.caption, '##') then
retval = retval .. '[[
end
end
Baris 252 ⟶ 267:
retval = retval .. '<span class="switcher-label" style="display:none">' .. args.switcherLabel .. '</span>'
elseif args.autoSwitcherLabel then
retval = retval .. '<span class="switcher-label" style="display:none">
end
Baris 264 ⟶ 279:
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
retval = retval .. '[[
end
end
Baris 274 ⟶ 289:
(map('crosses180') ~= '' and 'crosses180' or '') ..
(map('type') ~= '' and 'type' or '')
retval = retval .. '[[
end
end
Baris 280 ⟶ 295:
mw.log('Pipe used in name of map definition ' .. map())
if currentTitle.namespace == 0 then
retval = retval .. '[[
end
end
Baris 416 ⟶ 431:
end
if args.link and (currentTitle.namespace == 0) then
builder:wikitext('[[
end
end
if not longitude then
error('
elseif not latitude then
error('
end
if currentTitle.namespace > 0 then
if (not args.lon_deg) ~= (not args.lat_deg) then
builder:wikitext('[[
elseif (not args.lon_min) ~= (not args.lat_min) then
builder:wikitext('[[
elseif (not args.lon_sec) ~= (not args.lat_sec) then
builder:wikitext('[[
elseif (not args.lon_dir) ~= (not args.lat_dir) then
builder:wikitext('[[
elseif (not args.long) ~= (not args.lat) then
builder:wikitext('[[
end
end
if ((tonumber(args.lat_deg) or 0) < 0) and ((tonumber(args.lat_min) or 0) ~= 0 or (tonumber(args.lat_sec) or 0) ~= 0 or (args.lat_dir and args.lat_dir ~='')) then
builder:wikitext('[[
end
if ((tonumber(args.lon_deg) or 0) < 0) and ((tonumber(args.lon_min) or 0) ~= 0 or (tonumber(args.lon_sec) or 0) ~= 0 or (args.lon_dir and args.lon_dir ~= '')) then
builder:wikitext('[[
end
if (((tonumber(args.lat_min) or 0) < 0) or ((tonumber(args.lat_sec) or 0) < 0)) then
builder:wikitext('[[
end
if (((tonumber(args.lon_min) or 0) < 0) or ((tonumber(args.lon_sec) or 0) < 0)) then
builder:wikitext('[[
end
if args.skew or args.lon_shift or args.markhigh then
Baris 460 ⟶ 475:
(args.lon_shift and 'lon_shift' or '') ..
(args.markhigh and 'markhigh' or '')
builder:wikitext('[[
end
end
Baris 482 ⟶ 497:
if currentTitle.namespace == 0 then
local key = currentTitle.prefixedText
builder:wikitext('[[
end
end
Baris 541 ⟶ 556:
local altmaps = switcherSeparate(args.AlternativeMap)
if #altmaps > #map then
error(string.format('%d
end
local overlays = switcherSeparate(args.overlay_image)
if #overlays > #map then
error(string.format('%d overlay_images
end
if #caption_list > #map then
error(string.format('%d captions
end
local outputs = {}
|