无编辑摘要 标签:已被回退 |
无编辑摘要 标签:已被回退 |
||
| 第1行: | 第1行: | ||
-- Module: | -- Module:BusStops | ||
local p = {} | local p = {} | ||
function p.display(frame) | function p.display(frame) | ||
local db = mw.ext.data.getDB() -- 假设dt2-showtable提供数据库接口 | |||
local rows = db:query{ | |||
table = 'stoptable', | |||
where = { route = 'Z103' }, | |||
order_by = 'route' | |||
} | |||
local html = mw.html.create('table'):addClass('wikitable') | local html = mw.html.create('table'):addClass('wikitable') | ||
html:node(frame:expandTemplate{ title = ' | html:node(frame:expandTemplate{ title = '新站点表格头' }) | ||
local downno1 = 0 | |||
for _, row in ipairs(rows) do | |||
local downno = row.downno or tostring(downno1) | |||
html:node(frame:expandTemplate{ | |||
title = '站点计数', | |||
args = row | |||
}) | |||
html:node(frame:expandTemplate{ | |||
title = '站点展示', | |||
args = { stop = row.stop, road = row.road, upno = row.upno, downno = downno, upattr = row.upattr, downattr = row.downattr } | |||
}) | |||
end | |||
return tostring(html) | return tostring(html) | ||
end | end | ||
return p | return p | ||
2025年4月15日 (二) 11:03的版本
此模块的文档可以在模块:BusDepot/doc创建
-- Module:BusStops
local p = {}
function p.display(frame)
local db = mw.ext.data.getDB() -- 假设dt2-showtable提供数据库接口
local rows = db:query{
table = 'stoptable',
where = { route = 'Z103' },
order_by = 'route'
}
local html = mw.html.create('table'):addClass('wikitable')
html:node(frame:expandTemplate{ title = '新站点表格头' })
local downno1 = 0
for _, row in ipairs(rows) do
local downno = row.downno or tostring(downno1)
html:node(frame:expandTemplate{
title = '站点计数',
args = row
})
html:node(frame:expandTemplate{
title = '站点展示',
args = { stop = row.stop, road = row.road, upno = row.upno, downno = downno, upattr = row.upattr, downattr = row.downattr }
})
end
return tostring(html)
end
return p