Module:TabbedDialogue
Jump to navigation
Jump to search
Documentation for this module may be created at Module:TabbedDialogue/doc
local p = {}
function p.main(frame)
local args = require("Module:Arguments").getArgs(frame)
local result = {}
local i_title = 0
local i_event
local title, event, dialogue
table.insert(result, '<tabber>')
while true do
i_title = i_title + 1
title = args['Title' .. i_title] -- {{{Titlei}}}
if (title and (string.len(title) > 0)) or (i_title == 1) then
table.insert(result, '|-| ' .. (title or ' ') .. '=')
table.insert(result, '<div style="display: none;"><b>' .. (title or ' ') .. '</b></div>')
table.insert(result, '{| class="dialogue-table__inner"')
i_event = 0
while true do
i_event = i_event + 1
event = args['Title' .. i_title .. '_Event' .. i_event] or nil -- {{{Titlei_Eventj}}}
dialogue = args['Title' .. i_title .. '_Dialogue' .. i_event] or nil -- {{{Titlei_Dialoguej}}}
if event or dialogue then
table.insert(result, '|-')
table.insert(result, '! class="td-title" scope="row" | ' .. (event or ''))
table.insert(result, '| ' .. (dialogue or ''))
else
table.insert(result, '|}')
break
end
end
else
break
end
end
table.insert(result, '</tabber>')
return frame:preprocess(table.concat(result, '\n'))
end
return p