模組:香港巴士
外观
![]() | 此模块被引用於約2,900個頁面。 為了避免造成大規模的影響,所有對此模块的編輯應先於沙盒或測試樣例上測試。 測試後無誤的版本可以一次性地加入此模块中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
子模組
- Module:香港巴士/hki:港島巴士
- Module:香港巴士/klnt:九龍及新界巴士
- Module:香港巴士/crh:過海隧道巴士
- Module:香港巴士/lantau:大嶼山巴士
- Module:香港巴士/aex:機場快綫穿梭巴士
-- placeholder for subpage, will be written later
-- rewrite {{九龍新界巴士簡單列表}} etc. into module to reduce load
local getArgs = require('Module:Arguments').getArgs
local alldata = {
klnt = require('Module:香港巴士/klnt');
hki = require('Module:香港巴士/hki');
crh = require('Module:香港巴士/crh');
lantau = require('Module:香港巴士/lantau');
aex = require('Module:香港巴士/aex')
}
local p = {}
local dir = {'↺','→','⇄','→<br/>←','↺<br/>←','→<br/>↺'}
function split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
local grp = '|-\n| style="text-align: right; padding-right: 10px" |'
if args[1] == "klnt" or args[1] == "九龍" or args[1] == "新界" or args[1] == "九龍新界" then grp = "klnt"
elseif args[1] == "hki" or args[1] == "港島" or args[1] == "香港島" then grp = "hki"
elseif args[1] == "crh" or args[1] == "過海" then grp = "crh"
elseif args[1] == "lantau" or args[1] == "大嶼山" then grp = "lantau"
elseif args[1] == "aex" or args[1] == "機場" then grp = "aex"
end
local data = alldata[grp]
local out = ""
-- Main module code goes here.
return table.getn(args);
-- for i = 1, table.getn(args), 1 do
-- out = out .. args[i]
-- if data[args[i]] then
-- out = out .. '\n| style="text-align: right; white-space: nowrap" | '
-- local special = string.find('' .. args[i], "_s")
-- if special then
-- out = out .. data[args[i]]['special' .. split(args[i], "_s")[2] .. '_endpoint1']
-- .. '\n| style="text-align: center; padding: 0px 8px 0px 8px" |'
-- .. dir[data[args[i]]['special' .. split(args[i], "_s")[2] .. '_direction']+1]
-- .. '\n| style="white-space: nowrap" |'
-- .. data[args[i]]['special' .. split(args[i], "_s")[2] .. '_endpoint2']
-- .. '\n| style="padding-left: 10px" |'
-- .. data[args[i]]['special' .. split(args[i], "_s")[2] .. '_status']
-- else
-- out = out .. data[args[i]]['endpoint1']
-- .. '\n| style="text-align: center; padding: 0px 8px 0px 8px" |'
-- .. dir[data[args[i]]['direction']+1]
-- .. '\n| style="white-space: nowrap" |'
-- .. data[args[i]]['endpoint2']
-- .. '\n| style="padding-left: 10px" |'
-- .. data[args[i]]['status']
-- end
-- else
-- out = out .. '\n| colspan="3" style="text-align: center" | (沒有資料)'
-- end
-- end
-- return out
end
return p