Content added Content deleted
mNo edit summary |
No edit summary |
||
Line 30: | Line 30: | ||
{ name = 'type' }, |
{ name = 'type' }, |
||
{ name = 'festival' }, |
{ name = 'festival' }, |
||
{ name = 'pity' }, |
|||
{ name = 'currency' } |
|||
} |
} |
||
:setArgs(args) |
:setArgs(args) |
||
Line 59: | Line 61: | ||
{ tag = 'th', content = 'Gacha type', colspan = 12 }, |
{ tag = 'th', content = 'Gacha type', colspan = 12 }, |
||
{ tag = 'argtd', content = 'type', colspan = 18 } |
{ tag = 'argtd', content = 'type', colspan = 18 } |
||
}) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Has pity?', colspan = 12 }, |
|||
{ tag = 'argtd', content = 'pity', colspan = 18 } |
|||
}) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Currency', colspan = 12 }, |
|||
{ tag = 'argtd', content = 'currency', colspan = 18 } |
|||
}) |
}) |
||
Revision as of 21:31, 5 January 2022
This module depends on the following other modules: |
To generate {{Infobox gacha}}, invoke using the main function.
--------------------------
-- Module for [[Template:Infobox gacha]]
------------------------
local getArgs = require('Module:Arguments').getArgs
local builder = require('Module:InfoboxBuilder')
local p = {}
local categories = ""
local function formatImage(image_name)
return string.format("[[File:%s|x100px]]", image_name)
end
function p.main(frame)
local args = getArgs(frame)
local infobox = builder.new()
infobox:setName('Infobox gacha')
:setWidth("330px")
:setParams{
{ name = 'gacha id' },
{ name = 'gacha name', default = mw.title.getCurrentTitle().text },
{ name = 'image', func = formatImage },
{ name = 'banner', func = formatImage },
{ name = 'japanese' },
{ name = 'romaji' },
{ name = 'start' },
{ name = 'end' },
{ name = 'type' },
{ name = 'festival' },
{ name = 'pity' },
{ name = 'currency' }
}
:setArgs(args)
infobox
:addHeader({ tag = 'argth', content = 'gacha name' })
:addImage({
{ tag = 'argtd', content = 'image', title = 'Logo' },
{ tag = 'argtd', content = 'banner', title = 'Banner' }
})
:addRow({
{ tag = 'th', content = 'Japanese', colspan = 12 },
{ tag = 'argtd', content = 'japanese', colspan = 18 }
})
:addRow({
{ tag = 'th', content = 'Romaji', colspan = 12 },
{ tag = 'argtd', content = 'romaji', colspan = 18 }
})
:addHeader({ tag = 'th', content = 'Gacha Information' }, { subheader = true })
:addRow({
{ tag = 'th', content = 'Start date', colspan = 12 },
{ tag = 'argtd', content = 'start', colspan = 18 }
})
:addRow({
{ tag = 'th', content = 'End date', colspan = 12 },
{ tag = 'argtd', content = 'end', colspan = 18 }
})
:addRow({
{ tag = 'th', content = 'Gacha type', colspan = 12 },
{ tag = 'argtd', content = 'type', colspan = 18 }
})
:addRow({
{ tag = 'th', content = 'Has pity?', colspan = 12 },
{ tag = 'argtd', content = 'pity', colspan = 18 }
})
:addRow({
{ tag = 'th', content = 'Currency', colspan = 12 },
{ tag = 'argtd', content = 'currency', colspan = 18 }
})
if mw.title.getCurrentTitle().namespace == 0 then
categories = "[[Category:Gachas]]" .. categories
end
return infobox:tostring() .. categories
end
return p