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

n 𠊝替文本-「Mô đun:Arguments」成「模庉:Arguments」
(討論 | 㨂𢵰)
空固縿略𢯢𢷮
 
(空顯示3番版𧵑2𠊛用於𡧲)
𣳔3: 𣳔3:
phương thức, nhất là:
phương thức, nhất là:


{{#invoke:Coordinates | coord }} : Hàm tổng quát để định dạng và hiển thị các giá
{{#gọi:Coordinates | coord }} : Hàm tổng quát để định dạng và hiển thị các giá
trị tọa độ.
trị tọa độ.


{{#invoke:Coordinates | dec2dms }} : Hàm đơn giản để chuyển đổi các giá trị thập
{{#gọi:Coordinates | dec2dms }} : Hàm đơn giản để chuyển đổi các giá trị thập
phân ra định dạng độ-phút-giây.
phân ra định dạng độ-phút-giây.


{{#invoke:Coordinates | dms2dec }} : Hàm đơn giản để chuyển đổi định dạng
{{#gọi:Coordinates | dms2dec }} : Hàm đơn giản để chuyển đổi định dạng
độ-phút-giây ra định dạng độ thập phân.
độ-phút-giây ra định dạng độ thập phân.


{{#invoke:Coordinates | link }} : Xuất địa chỉ của các công cụ.
{{#gọi:Coordinates | link }} : Xuất địa chỉ của các công cụ.


]=]
]=]


require('Module:No globals')
require('strict')


local math_mod = require("Module:Math")
local math_mod = require("Module:Math")
𣳔27: 𣳔27:
-- Định dạng các số theo quy tắc tiếng Việt (thí dụ 1.234,56).
-- Định dạng các số theo quy tắc tiếng Việt (thí dụ 1.234,56).
local lang = mw.getContentLanguage()
local lang = mw.getContentLanguage()
-- Chuyển đổi đối số thành các giá trị tiếng Anh.
local function delocalizeArguments(args)
-- Chuyển vị bảng đối số
local transposedArgs = {}
for i, arg in ipairs(args) do
transposedArgs[mw.ustring.upper(arg)] = i
end
if transposedArgs["B"] ~= nil then
args[transposedArgs["B"]] = "N"
end
-- “N” có thể có nghĩa hướng nam trong tiếng Việt hoặc hướng bắc trong tiếng Anh.
if transposedArgs["N"] ~= nil and (transposedArgs["Đ"] ~= nil or transposedArgs["T"] ~= nil) then
args[transposedArgs["N"]] = "S"
end
if transposedArgs["Đ"] ~= nil then
args[transposedArgs["Đ"]] = "E"
end
if transposedArgs["T"] ~= nil then
args[transposedArgs["T"]] = "W"
end
end


--[[ Hàm hỗ trợ thay thế {{coord/display/title}} ]]
--[[ Hàm hỗ trợ thay thế {{coord/display/title}} ]]
local function displaytitle(s, notes)
local function displaytitle(s, notes)
local l = "[[Hệ tọa độ địa lý|Tọa độ]]: " .. s
local htmlTitle = '<span style="margin-right: 0.25rem;">' .. s .. notes .. '</span>';
local co = '<span id="coordinates">' .. l .. notes .. '</span>';
return mw.getCurrentFrame():extensionTag('indicator', tostring(htmlTitle), { name = '#coordinates' })
return '<span style="font-size: small;">' .. co .. '</span>';
end
end


𣳔56: 𣳔78:




--[[ Hàm bọc để lấy các tham số; xem tài liệu của hàm này tại 模庉:Arguments. ]]
--[[ Hàm bọc để lấy các tham số; xem tài liệu của hàm này tại Mô đun:Arguments. ]]
local function makeInvokeFunc(funcName)
local function makeInvokeFunc(funcName)
return function (frame)
return function (frame)
local args = require('模庉:Arguments').getArgs(frame, {
local args = require('Mô đun:Arguments').getArgs(frame, {
wrappers = 'Bản mẫu:Tọa độ'
wrappers = 'Bản mẫu:Tọa độ'
})
})
𣳔172: 𣳔194:
end
end


return '<span class="plainlinks nourlexpansion">' ..
    local stylesheetLink = 'Module:Coordinates/styles.css'
'[' .. coord_link .. uriComponents .. ' ' .. inner .. ']' .. '</span>'
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = stylesheetLink }
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..
' ' .. inner .. ']</span>'
end
end


𣳔558: 𣳔583:


Cách sử dụng:
Cách sử dụng:
{{ #invoke:Coordinates | link }}
{{ #gọi:Coordinates | link }}
]]
]]
𣳔571: 𣳔596:


Cách sử dụng:
Cách sử dụng:
{{ #invoke:Coordinates | dec2dms | tọa độ thập phân | hậu tố cho số dương |  
{{ #gọi:Coordinates | dec2dms | tọa độ thập phân | hậu tố cho số dương |  
hậu tố cho số âm | độ chính xác }}
hậu tố cho số âm | độ chính xác }}


𣳔610: 𣳔635:


Cách sử dụng:
Cách sử dụng:
{{ #invoke:Coordinates | dms2dec | chữ bán cầu | độ |  
{{ #gọi:Coordinates | dms2dec | chữ bán cầu | độ |  
phút | giây }}
phút | giây }}


𣳔633: 𣳔658:


Cách sử dụng:
Cách sử dụng:
{{ #invoke:Coordinates | coord }}
{{ #gọi:Coordinates | coord }}
{{ #invoke:Coordinates | coord | vĩ độ | kinh độ }}
{{ #gọi:Coordinates | coord | vĩ độ | kinh độ }}
{{ #invoke:Coordinates | coord | vĩ độ | chữ vĩ độ | kinh độ | chữ kinh độ }}
{{ #gọi:Coordinates | coord | vĩ độ | chữ vĩ độ | kinh độ | chữ kinh độ }}
𣳔669: 𣳔694:
args.wviTitle = (string.find( Display, 'title' ) ~= nil or Display == 't' or  
args.wviTitle = (string.find( Display, 'title' ) ~= nil or Display == 't' or  
Display == 'it' or Display == 'ti')
Display == 'it' or Display == 'ti')
delocalizeArguments(args)
local contents, backward = formatTest(args)
local contents, backward = formatTest(args)
local coordPF = formatTest(args)
local Notes = args.notes or ''
local Notes = args.notes or ''


𣳔707: 𣳔732:
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end
end
end
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'tài liệu' and page_title.subpageText ~= 'testcases' and page_title.subpageText ~='kiểm thử' then args[10] = 'primary' end
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'tài liệu' and page_title.subpageText ~= 'testcases' and page_title.subpageText ~='kiểm thử' then args[10] = 'primary' end
args.notes, args.format, args.display = nil
args.notes, args.format, args.display = nil
text = text .. coord_wrapper(args)
text = text .. coord_wrapper(args)
𣳔722: 𣳔747:
Cách sử dụng:
Cách sử dụng:


     {{#invoke:Coordinates | coord2text | {{Tọa độ}} | parameter }}
     {{#gọi:Coordinates | coord2text | {{Tọa độ}} | parameter }}


Giá trị hợp lệ cho tham số thứ hai là: lat (số nguyên có dấu), long (số nguyên có dấu), type, scale, dim, region, globe, source
Giá trị hợp lệ cho tham số thứ hai là: lat (số nguyên có dấu), long (số nguyên có dấu), type, scale, dim, region, globe, source