恪別𡧲版𢯢𢷮𧵑「模庉:Location map」

造張㵋貝內容「require('strict') local p = {} local argByViArg = { khung = "border", ["chú thích"] = "caption", ["nhãn"] = "label", ["trôi"] = "float", ["rộng"] = "width", ["rộng mặc định"] = "default_width", ["địa hình nổi"] = "relief", ["BD thay thế"] = "AlternativeMap", ["hình phủ"] = "overlay_image", ["kích thước nhãn"] = "label_size", ["rộng nhãn"] = "label_width", ["điểm"] = "mark", ["kích thước điểm"] = "marksize", ["…」
 
n 𠊝替文本-「Mô đun:」成「Module:」
 
(空顯示5番版𧵑2𠊛用於𡧲)
𣳔32: 𣳔32:
}
}


local rawGetArgs = require('Mô đun:Arguments').getArgs
local rawGetArgs = require('模庉:Arguments').getArgs
local getArgs = function (frame, options)
local getArgs = function (frame, options)
local args = rawGetArgs(frame, options)
local args = rawGetArgs(frame, options)
𣳔63: 𣳔63:
error('Cần định rõ tên của trang định rõ bản đồ định vị để sử dụng', 2)
error('Cần định rõ tên của trang định rõ bản đồ định vị để sử dụng', 2)
end
end
local moduletitle = mw.title.new('Mô đun:Location map/data/' .. map)
local moduletitle = mw.title.new('Module:Location map/data/' .. map)
if not moduletitle then
if not moduletitle then
error(string.format('%q không phải là tên hợp lệ của trang định rõ bản đồ định vị', map), 2)
error(string.format('%q không phải là tên hợp lệ của trang định rõ bản đồ định vị', map), 2)
elseif moduletitle.exists then
elseif moduletitle.exists then
local mapData = mw.loadData('Mô đun:Location map/data/' .. map)
local mapData = mw.loadData('Module:Location map/data/' .. map)
return function(name, params)
return function(name, params)
if name == nil then
if name == nil then
return 'Mô đun:Location map/data/' .. map
return 'Module:Location map/data/' .. map
elseif mapData[name] == nil then
elseif mapData[name] == nil then
return ''
return ''
𣳔79: 𣳔79:
end
end
end
end
elseif mw.title.new('Bản mẫu:Bản đồ định vị ' .. map).exists then
elseif mw.title.new('Template:Bản đồ định vị ' .. map).exists then
local cache = {}
local cache = {}
return function(name, params)
return function(name, params)
𣳔86: 𣳔86:
else
else
if name == nil then
if name == nil then
return 'Bản mẫu:Bản đồ định vị ' .. map
return 'Template:Bản đồ định vị ' .. map
elseif cache[name] == nil then
elseif cache[name] == nil then
cache[name] = frame:expandTemplate{title = 'Bản đồ định vị ' .. map, args = { name }}
cache[name] = frame:expandTemplate{title = 'Bản đồ định vị ' .. map, args = { name }}
𣳔93: 𣳔93:
end
end
end
end
elseif mw.title.new('Bản mẫu:Location map ' .. map).exists then
elseif mw.title.new('Template:Location map ' .. map).exists then
local cache = {}
local cache = {}
if type(frame) ~= 'table' or type(frame.expandTemplate) ~= 'function' then
if type(frame) ~= 'table' or type(frame.expandTemplate) ~= 'function' then
𣳔103: 𣳔103:
else
else
if name == nil then
if name == nil then
return 'Bản mẫu:Location map ' .. map
return 'Template:Location map ' .. map
elseif cache[name] == nil then
elseif cache[name] == nil then
cache[name] = frame:expandTemplate{title = 'Location map ' .. map, args = { name }}
cache[name] = frame:expandTemplate{title = 'Location map ' .. map, args = { name }}
𣳔111: 𣳔111:
end
end
else
else
error('Không tìm thấy trang định rõ bản đồ định vị. "Mô đun:Location map/data/' .. map .. '", "Bản mẫu:Bản đồ định vị ' .. map .. '", và "Bản mẫu:Location map ' .. map .. '" đều không tồn tại', 2)
error('Không tìm thấy trang định rõ bản đồ định vị. "Module:Location map/data/' .. map .. '", "Template:Bản đồ định vị ' .. map .. '", và "Template:Location map ' .. map .. '" đều không tồn tại', 2)
end
end
end
end
𣳔276: 𣳔276:
local currentTitle = mw.title.getCurrentTitle()
local currentTitle = mw.title.getCurrentTitle()
retval = string.format(
retval = string.format(
'%s[[Tập tin:%s|%spx|%s%s]]',
'%s[[Image:%s|%spx|%s%s]]',
retval,
retval,
image,
image,
𣳔285: 𣳔285:
if args.caption and args.caption ~= '' then
if args.caption and args.caption ~= '' then
if (currentTitle.namespace == 0) and mw.ustring.find(args.caption, '##') then
if (currentTitle.namespace == 0) and mw.ustring.find(args.caption, '##') then
retval = retval .. '[[Thể loại:Trang có hai dấu thăng trong chú thích bản đồ định vị]]'
retval = retval .. '[[體類:Trang có hai dấu thăng trong chú thích bản đồ định vị]]'
end
end
end
end
if args.overlay_image then
if args.overlay_image then
return retval .. '<div style="position:absolute;top:0;left:0">[[Tập tin:' .. args.overlay_image .. '|' .. width .. 'px]]</div>'
return retval .. '<div style="position:absolute;top:0;left:0">[[Image:' .. args.overlay_image .. '|' .. width .. 'px]]</div>'
else
else
return retval
return retval
𣳔315: 𣳔315:
elseif args.caption ~= ''  then
elseif args.caption ~= ''  then
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:Tập tin:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>'
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>'
end
end


𣳔333: 𣳔333:
mw.logObject(args, 'args')
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
if currentTitle.namespace == 0 then
    retval = retval .. '[[Thể loại:Bản đồ định vị có tham số dời|caption_undefined]]'
    retval = retval .. '[[體類:Bản đồ định vị có tham số dời|caption_undefined]]'
end
end
end
end
𣳔343: 𣳔343:
(map('crosses180') ~= '' and 'crosses180' or '') ..
(map('crosses180') ~= '' and 'crosses180' or '') ..
(map('type') ~= '' and 'type' or '')
(map('type') ~= '' and 'type' or '')
    retval = retval .. '[[Thể loại:Bản đồ định vị có tham số dời|' .. key .. ' ]]'
    retval = retval .. '[[體類:Bản đồ định vị có tham số dời|' .. key .. ' ]]'
end
end
end
end
𣳔349: 𣳔349:
mw.log('Pipe used in name of map definition ' .. map())
mw.log('Pipe used in name of map definition ' .. map())
if currentTitle.namespace == 0 then
if currentTitle.namespace == 0 then
  retval = retval .. '[[Thể loại:Bản đồ định vị có dấu sổ thẳng trong tên]]'
  retval = retval .. '[[體類:Bản đồ định vị có dấu sổ thẳng trong tên]]'
end
end
end
end
𣳔371: 𣳔371:
if marksize ~= 0 then
if marksize ~= 0 then
builder:wikitext(string.format(
builder:wikitext(string.format(
'[[Tập tin:%s|%dx%dpx|%s|link=%s%s]]',
'[[Image:%s|%dx%dpx|%s|link=%s%s]]',
mark,
mark,
marksize,
marksize,
𣳔432: 𣳔432:
function p.mark(frame, args, map)
function p.mark(frame, args, map)
if not args then
if not args then
args = getArgs(frame, {wrappers = 'Bản mẫu:Bản đồ định vị~'})
args = getArgs(frame, {wrappers = 'Template:Bản đồ định vị~'})
end
end
local mapnames = {}
local mapnames = {}
𣳔477: 𣳔477:


-- if longitude or latitude then
-- if longitude or latitude then
-- error('Tọa độ từ [[Mô đun:Coordinates]] và tọa độ riêng lẻ không thể cả hai đều được cung cấp')
-- error('Tọa độ từ [[Module:Coordinates]] và tọa độ riêng lẻ không thể cả hai đều được cung cấp')
-- end
-- end
longitude = coord2text('longitude', args.coordinates)
longitude = coord2text('longitude', args.coordinates)
𣳔489: 𣳔489:
end
end
if args.link and (currentTitle.namespace == 0) then
if args.link and (currentTitle.namespace == 0) then
builder:wikitext('[[Thể loại:Bản đồ định vị có ghim được liên kết lấy tọa độ từ Wikidata]]')
builder:wikitext('[[體類:Bản đồ định vị có ghim được liên kết lấy tọa độ từ Wikidata]]')
end
end
end
end
𣳔499: 𣳔499:
if currentTitle.namespace > 0 then
if currentTitle.namespace > 0 then
if (not args.lon_deg) ~= (not args.lat_deg) then
if (not args.lon_deg) ~= (not args.lat_deg) then
builder:wikitext('[[Thể loại:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Độ]]')
builder:wikitext('[[體類:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Độ]]')
elseif (not args.lon_min) ~= (not args.lat_min) then
elseif (not args.lon_min) ~= (not args.lat_min) then
builder:wikitext('[[Thể loại:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Phút]]')
builder:wikitext('[[體類:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Phút]]')
elseif (not args.lon_sec) ~= (not args.lat_sec) then
elseif (not args.lon_sec) ~= (not args.lat_sec) then
builder:wikitext('[[Thể loại:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Giây]]')
builder:wikitext('[[體類:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Giây]]')
elseif (not args.lon_dir) ~= (not args.lat_dir) then
elseif (not args.lon_dir) ~= (not args.lat_dir) then
builder:wikitext('[[Thể loại:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Bán cầu]]')
builder:wikitext('[[體類:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Bán cầu]]')
elseif (not args.long) ~= (not args.lat) then
elseif (not args.long) ~= (not args.lat) then
builder:wikitext('[[Thể loại:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Thập phân]]')
builder:wikitext('[[體類:Bản đồ định vị có độ chính xác kinh độ và vĩ độ khác nhau|Thập phân]]')
end
end
end
end
𣳔521: 𣳔521:
(args.lon_shift and 'lon_shift' or '') ..
(args.lon_shift and 'lon_shift' or '') ..
(args.markhigh and 'markhigh' or '')
(args.markhigh and 'markhigh' or '')
builder:wikitext('[[Thể loại:Bản đồ định vị có tham số dời|' .. key ..' ]]')
builder:wikitext('[[體類:Bản đồ định vị có tham số dời|' .. key ..' ]]')
end
end
end
end
𣳔543: 𣳔543:
if currentTitle.namespace == 0 then
if currentTitle.namespace == 0 then
local key = frame:preprocess('{{FULLPAGENAME}}')
local key = frame:preprocess('{{FULLPAGENAME}}')
builder:wikitext('[[Thể loại:Bản đồ định vị không định trước rằng ghim nằm ngoài bản đồ|' .. key .. ' ]]')
builder:wikitext('[[體類:Bản đồ định vị không định trước rằng ghim nằm ngoài bản đồ|' .. key .. ' ]]')
end
end
end
end
𣳔572: 𣳔572:
local caption_list = {}
local caption_list = {}
if not args then
if not args then
args = getArgs(frame, {wrappers = 'Bản mẫu:Bản đồ định vị', valueFunc = p.valueFunc})
args = getArgs(frame, {wrappers = 'Template:Bản đồ định vị', valueFunc = p.valueFunc})
end
end
if args.useWikidata == nil then
if args.useWikidata == nil then