Content added Content deleted
mNo edit summary |
mNo edit summary |
||
Line 42: | Line 42: | ||
{ tag = 'argtd', content = 'thumbnail' }, |
{ tag = 'argtd', content = 'thumbnail' }, |
||
}) |
}) |
||
:addRow( |
:addRow( |
||
⚫ | |||
⚫ | |||
{ tag = ' |
{ tag = 'th', content = 'Japanese', colspan = 12 }, |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{ |
{ hideIfEmpty = { 'japanese' } } |
||
) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
{ |
|||
⚫ | |||
{ tag = 'argtd', content = 'romaji', colspan = 18 } |
|||
}, |
|||
{ hideIfEmpty = { 'romaji' } } |
|||
) |
|||
:addHeader({ tag = 'th', content = 'Costume Information' }, { subheader = true }) |
:addHeader({ tag = 'th', content = 'Costume Information' }, { subheader = true }) |
||
:addRow( |
:addRow( |
Revision as of 16:54, 14 October 2021
This module depends on the following other modules: |
To generate {{Infobox costume}}, invoke using the main function.
--------------------------
-- Module for [[Template:Infobox Costume]]
------------------------
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|128px]]", image_name)
end
local function formatLink(to_link)
return '[[' .. to_link .. ']]'
end
function p.main(frame)
local args = getArgs(frame)
local infobox = builder.new()
infobox:setName('Infobox Costume')
:setWidth("330px")
:setParams{
{ name = 'costume id' },
{ name = 'costume name', default = mw.title.getCurrentTitle().text },
{ name = 'thumbnail', func = formatImage },
{ name = 'japanese' },
{ name = 'romaji' },
{ name = 'designer' },
{ name = 'card', func = formatLink },
}
:setArgs(args)
:setHeaderColors({
['background-color'] = '#00cdba',
['color'] = '#000'
})
infobox
:addHeader({ tag = 'argth', content = 'costume name' })
:addImage({
{ tag = 'argtd', content = 'thumbnail' },
})
:addRow(
{
{ tag = 'th', content = 'Japanese', colspan = 12 },
{ tag = 'argtd', content = 'japanese', colspan = 18 }
},
{ hideIfEmpty = { 'japanese' } }
)
:addRow(
{
{ tag = 'th', content = 'Romaji', colspan = 12 },
{ tag = 'argtd', content = 'romaji', colspan = 18 }
},
{ hideIfEmpty = { 'romaji' } }
)
:addHeader({ tag = 'th', content = 'Costume Information' }, { subheader = true })
:addRow(
{
{ tag = 'th', content = 'Designer', colspan = 12 },
{ tag = 'argtd', content = 'designer', colspan = 18 }
},
{ hideIfEmpty = { 'designer' } }
)
:addRow(
{
{ tag = 'th', content = 'Associated Card', colspan = 12 },
{ tag = 'argtd', content = 'card', colspan = 18 }
},
{ hideIfEmpty = { 'card' } }
)
if mw.title.getCurrentTitle().namespace == 0 then
categories = "[[Category:Costumes]]" .. categories
end
return infobox:tostring() .. categories
end
return p