Module:YouTube Preview
Appearance
Documentation for this module may be created at Module:YouTube Preview/doc
local p = {}
local seriesClasses = {
['sunshine'] = llss,
['nijigasaki'] = lln,
['superstar'] = llst,
['hasunosora'] = llll,
['sim'] = llsim,
['gny'] = gny,
['bluebird'] = llbb
}
local possibleRows = {
'Channel',
'Release',
'Illustration',
'Video',
'Production'
}
local function buildRow(title, content, style)
local row = mw.html.create('div')
:addClass('videobox-row')
row
:tag('div')
:addClass('videobox-title')
:addClass(style)
:wikitext(title)
row
:tag('div')
:wikitext(content)
return row
end
function p.main(frame)
local style = 'cat-ll'
if frame.args['Series'] then
style = 'cat-' .. frame.args['Series']
end
local root = mw.html.create('div')
local header = root:tag('div')
:addClass(videobox-header)
:addClass(style)
:wikitext(frame.args['Title'])
local video = root:tag('div')
:addClass(videobox-video)
:wikitext(string.format('<youtube width="300">%s</youtube>', frame.args['URL']))
for v in pairs(possibleRows) do
if frame.args[v] then
root:node(buildRow(v, frame.args[v], style))
end
end
return frame:extensionTag{
name = 'templatestyles',
args = { src = 'Module:YouTube Preview/styles.css' }
} .. tostring(root)
end
return p