小 ([InPageEdit] 没有编辑摘要) |
小 ([InPageEdit] 没有编辑摘要) |
||
第33行: | 第33行: | ||
mobile |
mobile |
||
:addClass("timeline-mobile-emptycell") |
:addClass("timeline-mobile-emptycell") |
||
:addClass(" |
:addClass("visible-sm") |
||
timeline:node(mobile) |
timeline:node(mobile) |
||
local line = mw.html.create("div") |
local line = mw.html.create("div") |
2023年8月1日 (二) 17:04的版本
local data = {}
local framework={}
local function getId(args)
for key, value in pairs(args) do
local prefix = string.match(key, "(%a+)%d+")
local index = tonumber(string.match(key, "%d"))
if index and not data[index] then
data[index] = {}
end
if prefix == "text" then
data[index][2] = value
elseif prefix == "id" then
data[index][1] = value
end
end
end
function framework.timeline(frame)
local args = frame:getParent().args
getId(args)
local timeline = mw.html.create("div")
timeline:addClass("timeline-framework")
local trunk = mw.html.create("div")
trunk
:addClass("timeline-trunk")
timeline:node(trunk)
for index, value in ipairs(data) do
local branch = mw.html.create("div")
branch
:addClass("timeline-branch")
:attr("id","timeline-branch-" .. index)
timeline:node(branch)
local mobile=mw.html.create("div")
mobile
:addClass("timeline-mobile-emptycell")
:addClass("visible-sm")
timeline:node(mobile)
local line = mw.html.create("div")
line
:addClass("timeline-line")
:attr("id","timeline-line-" .. index)
branch:node(line)
if value[1] then
local id = mw.html.create("span")
id
:addClass("timeline-id")
:attr("id","timeline-id-" .. index)
:wikitext(value[1])
line:node(id)
end
if value[2] then
local text = mw.html.create("div")
text
:addClass("timeline-text")
:attr("id","timeline-text-" .. index)
:wikitext(value[2])
branch:node(text)
end
end
local empty=mw.html.create("div")
empty:addClass("timeline-emptycell")
timeline:node(empty)
return tostring(timeline)
end
return framework