More actions
Content deleted Content added
Created page with "local InfoboxBuilder = require('Module:InfoboxBuilder') local p = {} function p.main(frame) local args = frame:getParent().args local infobox = InfoboxBuilder.new() infobox:setName('Infobox after talk') :setParams { { name = 'title', default = mw.title.getCurrentTitle().text }, { name = 'japanese' }, { name = 'romaji' }, { name = 'english' }, { name = 'length', fn = ProcessingFns.stringToNumber }, { name = 'date' }, { name = 'feat' } } :..." |
No edit summary |
||
(20 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local getArgs = require('Module:Arguments').getArgs |
|||
local InfoboxBuilder = require('Module:InfoboxBuilder') |
local InfoboxBuilder = require('Module:InfoboxBuilder') |
||
local DisplayFns = require('Module:DisplayFunctions') |
|||
local ProcessingFns = require('Module:ProcessingFunctions') |
|||
local p = {} |
local p = {} |
||
Line 10: | Line 13: | ||
:setParams { |
:setParams { |
||
{ name = 'title', default = mw.title.getCurrentTitle().text }, |
{ name = 'title', default = mw.title.getCurrentTitle().text }, |
||
⚫ | |||
{ name = 'japanese' }, |
{ name = 'japanese' }, |
||
{ name = 'romaji' }, |
{ name = 'romaji' }, |
||
{ name = 'english' }, |
{ name = 'english' }, |
||
{ name = ' |
{ name = 'duration', fn = ProcessingFns.stringToNumber }, |
||
{ name = 'date' }, |
{ name = 'date' }, |
||
{ name = 'feat' } |
{ name = 'feat' } |
||
Line 21: | Line 25: | ||
infobox |
infobox |
||
:addHeader({ tag = 'argth', content = 'title' }) |
:addHeader({ tag = 'argth', content = 'title' }) |
||
--:addImage({ |
|||
--{ tag = 'argtd', content = 'image', fn = DisplayFns.image('220px') }, |
|||
--}) |
|||
:addRow( |
:addRow( |
||
{ |
{ |
||
{ tag = 'th', content = 'Japanese' }, |
{ tag = 'th', content = 'Japanese' }, |
||
{ tag = 'argtd', content = 'japanese' } |
{ tag = 'argtd', content = 'japanese' } |
||
} |
} |
||
{ hideIfEmpty = { 'japanese' } } |
|||
) |
) |
||
:addRow( |
:addRow( |
||
Line 32: | Line 38: | ||
{ tag = 'th', content = 'Romaji' }, |
{ tag = 'th', content = 'Romaji' }, |
||
{ tag = 'argtd', content = 'romaji' } |
{ tag = 'argtd', content = 'romaji' } |
||
} |
} |
||
{ hideIfEmpty = { 'romaji' } } |
|||
) |
) |
||
:addRow( |
:addRow( |
||
Line 47: | Line 52: | ||
{ |
{ |
||
tag = 'th', |
tag = 'th', |
||
content = ' |
content = 'Stream duration' |
||
}, |
}, |
||
{ |
{ |
||
tag = 'argtd', |
tag = 'argtd', |
||
content = ' |
content = 'duration', |
||
fn = DisplayFns. |
fn = DisplayFns.hoursAndMinutes |
||
} |
} |
||
} |
} |
||
{ hideIfEmpty = { 'length' } } |
|||
) |
) |
||
:addRow( |
:addRow( |
||
{ |
{ |
||
{ tag = th, 'Release date' }, |
{ tag = 'th', content = 'Release date' }, |
||
{ tag = argtd, 'date' } |
{ tag = 'argtd', content = 'date' } |
||
} |
} |
||
{ hideIfEmpty = { 'date' } } |
|||
) |
) |
||
:addRow( |
:addRow( |
||
{ |
|||
⚫ | |||
{ tag = |
{ tag = 'th', content = 'Featuring' }, |
||
{ tag = 'argtd', content = 'feat' } |
|||
} |
|||
) |
) |
||
return infobox:tostring() |
|||
end |
end |
||
Latest revision as of 14:58, 22 May 2024
Documentation for this module may be created at Module:Infobox after talk/doc
local getArgs = require('Module:Arguments').getArgs
local InfoboxBuilder = require('Module:InfoboxBuilder')
local DisplayFns = require('Module:DisplayFunctions')
local ProcessingFns = require('Module:ProcessingFunctions')
local p = {}
function p.main(frame)
local args = frame:getParent().args
local infobox = InfoboxBuilder.new()
infobox:setName('Infobox after talk')
:setParams {
{ name = 'title', default = mw.title.getCurrentTitle().text },
--{ name = 'image' },
{ name = 'japanese' },
{ name = 'romaji' },
{ name = 'english' },
{ name = 'duration', fn = ProcessingFns.stringToNumber },
{ name = 'date' },
{ name = 'feat' }
}
:setArgs(args)
:processArgs()
infobox
:addHeader({ tag = 'argth', content = 'title' })
--:addImage({
--{ tag = 'argtd', content = 'image', fn = DisplayFns.image('220px') },
--})
:addRow(
{
{ tag = 'th', content = 'Japanese' },
{ tag = 'argtd', content = 'japanese' }
}
)
:addRow(
{
{ tag = 'th', content = 'Romaji' },
{ tag = 'argtd', content = 'romaji' }
}
)
:addRow(
{
{ tag = 'th', content = 'English' },
{ tag = 'argtd', content = 'english' }
},
{ hideIfEmpty = { 'english' } }
)
:addHeader({ tag = 'th', content = 'Stream Information' }, { subheader = true })
:addRow(
{
{
tag = 'th',
content = 'Stream duration'
},
{
tag = 'argtd',
content = 'duration',
fn = DisplayFns.hoursAndMinutes
}
}
)
:addRow(
{
{ tag = 'th', content = 'Release date' },
{ tag = 'argtd', content = 'date' }
}
)
:addRow(
{
{ tag = 'th', content = 'Featuring' },
{ tag = 'argtd', content = 'feat' }
}
)
return infobox:tostring()
end
return p