Module:Featured: Difference between revisions
From PC Gaming Shelter
Tag: Undo |
No edit summary |
||
| Line 2: | Line 2: | ||
function p.video(frame) | function p.video(frame) | ||
local args | local args = frame:getParent().args or {} | ||
local header | local contentType = args[1] or 'video' | ||
local title | local header = args[2] or args['header'] or 'Navigate' | ||
local tagline = args[4] or args['tagline'] or 'Tagline' | local title = args[3] or args['title'] or 'Title' | ||
local | local tagline = args[4] or args['tagline'] or 'Tagline' | ||
local content = args[5] or args['url'] or args['image'] or args['text'] or '' | |||
local html = mw.html.create() | local html = mw.html.create() | ||
local order = 1 | |||
if contentType == 'video' then | |||
content = frame:callParserFunction('#tag', { | |||
'embedvideo', | |||
service = 'youtube', | |||
autoResize = '1', | |||
content | |||
}) | |||
elseif contentType == 'image' then | |||
-- | |||
elseif contentType == 'text' then | |||
order = 2 | |||
end | |||
if content ~= '' and ( contentType == 'video' or contentType == 'image' or contentType == 'text' ) then | |||
html:tag('div'):addClass('card bg-dark thumbwall mb-3') | html:tag('div'):addClass('card bg-dark thumbwall mb-3') | ||
:tag('div'):addClass('card-header'):wikitext(header):done() | :tag('div'):addClass('card-header order-0'):wikitext(header):done() | ||
:tag('div'):addClass('card-img'):wikitext( | :tag('div'):addClass('card-img' .. tostring(order)):wikitext(content):done() | ||
:tag('div'):addClass('card-body bg-dark flex-column') | :tag('div'):addClass('card-body bg-dark flex-column') | ||
:tag('div'):addClass('card-title mb-0'):wikitext(title):done() | :tag('div'):addClass('card-title mb-0'):wikitext(title):done() | ||
| Line 23: | Line 34: | ||
:done() | :done() | ||
:done() | :done() | ||
end | |||
return html | return html | ||
Revision as of 13:13, 27 March 2026
Documentation for this module may be created at Module:Featured/doc
local p = {}
function p.video(frame)
local args = frame:getParent().args or {}
local contentType = args[1] or 'video'
local header = args[2] or args['header'] or 'Navigate'
local title = args[3] or args['title'] or 'Title'
local tagline = args[4] or args['tagline'] or 'Tagline'
local content = args[5] or args['url'] or args['image'] or args['text'] or ''
local html = mw.html.create()
local order = 1
if contentType == 'video' then
content = frame:callParserFunction('#tag', {
'embedvideo',
service = 'youtube',
autoResize = '1',
content
})
elseif contentType == 'image' then
--
elseif contentType == 'text' then
order = 2
end
if content ~= '' and ( contentType == 'video' or contentType == 'image' or contentType == 'text' ) then
html:tag('div'):addClass('card bg-dark thumbwall mb-3')
:tag('div'):addClass('card-header order-0'):wikitext(header):done()
:tag('div'):addClass('card-img' .. tostring(order)):wikitext(content):done()
:tag('div'):addClass('card-body bg-dark flex-column')
:tag('div'):addClass('card-title mb-0'):wikitext(title):done()
:tag('div'):addClass('card-tagline h3 lead'):wikitext(tagline):done()
:done()
:done()
end
return html
end
return p
