• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
Created page with "-- Example how to not write modules. local ShipBattleCardKai = require('Module:ShipBattleCardKai') local EquipmentCardKai = require('Module:EquipmentCardKai') local function..."
-- Example how to not write modules.

local ShipBattleCardKai = require('Module:ShipBattleCardKai')
local EquipmentCardKai = require('Module:EquipmentCardKai')

local function render(args)
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

return {
render = render,
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',
}),
}
cssedit, gkautomate
6,942

edits

Navigation menu