- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Module:Fleet
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Fleet/doc
-- Example how to not write modules.
local ShipBattleCardKai = require('Module:ShipBattleCardKai')
local EquipmentCardKai = require('Module:EquipmentCardKai')
local function render(args, frame)
local result = {}
local firstCell = true
local openTab = false
local openSubtab = false
for _, arg in ipairs(args) do
if arg:sub(0, 2) == '!!' then
if openSubtab then
table.insert(result, string.format('|-| %s =\n{|class="wikitable" style="text-align:center"\n!Ship\n!colspan="4"|Equipment', arg:sub(3)))
else
table.insert(result, string.format('<tabber>\n|-| %s =\n{|class="wikitable" style="text-align:center"\n!Ship\n!colspan="4"|Equipment', arg:sub(3)))
openSubtab = true
end
elseif arg:sub(0, 1) == '!' then
if openSubtab then
table.insert(result, '</tabber>')
openSubtab = false
end
if openTab then
table.insert(result, string.format('{{!}}-{{!}} %s =', arg:sub(2)))
else
table.insert(result, string.format('{{#tag:tabber|\n{{!}}-{{!}} %s =', arg:sub(2)))
openTab = true
end
elseif arg == '-' then
table.insert(result, '|-')
firstCell = true
else
if firstCell then
table.insert(result, '|' .. ShipBattleCardKai:Asset({ arg, hd = true }))
firstCell = false
else
table.insert(result, '|' .. EquipmentCardKai:Asset({ arg, size = '100px' }))
end
end
end
if openSubtab then
table.insert(result, '</tabber>')
openSubtab = false
end
if openTab then
table.insert(result, '}}')
openTab = false
end
return table.concat(result, '\n')
end
local getArgs = require('Module:GetArgs')
return {
render = function(frame)
return frame:preprocess(render(getArgs{ frame = frame:getParent() }))
end,
test = render({
'!1 DD',
'!!Example 1',
'-', 'Yuudachi/Kai Ni', 'Type 3 Active Sonar',
'!!Example 2',
'-', 'Yuudachi/Kai Ni', 'Type 3 Active Sonar', 'Type 3 Active Sonar',
'!2 DD',
'!!Example 1',
'-', 'Yuudachi/Kai Ni', 'Type 3 Active Sonar',
'-', 'Shigure/Kai Ni', 'Type 3 Active Sonar',
'!!Example 2',
'-', 'Yuudachi/Kai Ni', 'Type 3 Active Sonar', 'Type 3 Active Sonar',
'-', 'Shigure/Kai Ni', 'Type 3 Active Sonar', 'Type 3 Active Sonar',
}),
}