查看“︁模块:BusLineData”︁的源代码
←
模块:BusLineData
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local z = {} function t(a) if a == nil then return '' else return a end end function fb(a, b) --a首选 if a == nil or a == '' then return b else return a end end function z.stop_detail(frame) wt = {} local route = frame.args[1] local direction = frame.args[2] local data_title = mw.title.new( 'Template:BusStopData.json' ) local data_content = data_title:getContent() local data = mw.text.jsonDecode(data_content) local stops = require('Module:BusLineData/' .. route)[direction] for i, item in ipairs(stops) do -- Line-end if type(item) == "string" then stop_data = data[item] j = {} j[1] = item elseif type(item) == "table" then stop_data = data[item[1]] j = item else j = {ec = '3'} stop_data = {0} end j['notes'] = {} -- Stop-end if stop_data == nil then j['ec'] = '0 无站点数据' stop_data = {0} end if type(stop_data[1]) == "table" then if j[2] == nil then j['ec'] = '1 需要指定站位' else stop_data = stop_data[j[2]] if stop_data == nil then j['ec'] = '2 未找到指定的站位' end end end -- Name if j['ec'] == '3' then table.insert(wt, '<tr><td>' .. i .. frame:preprocess('<td colspan="5"> [[Template:BusLineData#error|<span style="color:#f00">错误:0x3 不可接受的站点输入</span>]]')) elseif j['ec'] ~= nil then j['name'] = fb( j['name_custom'], j[1] ) table.insert(wt, '<tr><td>' .. i .. '<td>' .. frame:preprocess(t(j['name']) .. '<td colspan="4">[[Template:BusLineData#error|<span style="color:#f00">错误:0x' .. j['ec'] .. '</span>]]')) else j['name'] = fb( j['name_custom'], j[1] ) -- Road -- Administration -- Transfer j['transfer'] = frame:preprocess( t(stop_data['transfer']):gsub( '}}%s*{{BRT|', '}}<br/>{{BRT|'):gsub( '}}%s*{{AMTR|', '}}<br/>{{AMTR|'):gsub( '}}%s*{{CR|', '}}<br/>{{CR|')) -- Note(s) if stop_data['single'] == 1 then j['notes'] = {'单向车站'} end table.insert(j['notes'], j['note']) j['note'] = fb( j['note_custom'], table.concat( j['notes'], ",")) -- End table.insert(wt, '<tr><td>' .. i .. '<td>' .. frame:preprocess(t(j['name'])) .. '<td>' .. t(stop_data['road']) .. '<td>' .. t(stop_data['admin']) .. '<td>' .. j['transfer'] .. '<td>' .. j['note'] ) end end return '<table class="wikitable"><tr><th>站序<th>站名<th>道路<th>行政区<th>换乘站点<th>备注' .. table.concat(wt) .. '</table>' end function z.stop_inline(frame) wt = {} local route = frame.args[1] local direction = frame.args[2] local data = require('Module:BusLineData/' .. route)[direction] for i, item in ipairs(data) do if type(item) == "string" then stop = item elseif type(item) == "table" then stop = item[1] else stop = '<span style="color:#f00">错误:0x3</span>' end table.insert(wt, (frame:preprocess( t(stop):gsub( '<br%s?/?>', '') ))) end return table.concat( wt, '、' ) .. '。' end function z.stop_count(frame) wt = {} local route = frame.args[1] local direction = frame.args[2] local data = require('Module:BusLineData/' .. route)[direction] return #data end return z
该页面使用的模板:
模块:BusLineData/doc
(
查看源代码
)
返回
模块:BusLineData
。
导航菜单
个人工具
登录
命名空间
模块
讨论
English
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
工具
链入页面
相关更改
特殊页面
页面信息