PC Gaming Shelter
An archive dedicated to preserving PC Gaming history and more

Module:Featured: Difference between revisions

From PC Gaming Shelter
No edit summary
No edit summary
Line 3: Line 3:
function p.video(frame)
function p.video(frame)
   local args        = frame:getParent().args or {}
   local args        = frame:getParent().args or {}
  local contentType = args[1] or 'video'
   local header      = args[2] or args['header'] or 'Navigate'
   local header      = args[2] or args['header'] or 'Navigate'
   local title      = args[3] or args['title'] or 'Title'
   local title      = args[3] or args['title'] or 'Title'
   local tagline    = args[4] or args['tagline'] or 'Tagline'
   local tagline    = args[4] or args['tagline'] or 'Tagline'
   local content    = args[5] or args['url'] or args['image'] or args['text'] or ''
   local content    = args[5] or args['id'] or args['url'] or ''
    
    
   local html = mw.html.create()
   local html = mw.html.create()
    
    
   local order = 1
   html:tag('div'):addClass('card bg-dark thumbwall mb-3')
  if contentType == 'video' then
:tag('div'):addClass('card-header order-0'):wikitext(header):done()
  content = frame:callParserFunction('#tag', {
:tag('div'):addClass('card-img'):wikitext(content):done()
  'embedvideo',
:tag('div'):addClass('card-body bg-dark flex-column')
  service = 'youtube'
:tag('div'):addClass('card-title mb-0'):wikitext(title):done()
  autoResize = '1',
:tag('div'):addClass('card-tagline h3 lead'):wikitext(tagline):done()
  content
:done()
})
  :done()
   elseif contentType == 'image' then
 
  --
  return html
   elseif contentType == 'text' then
end
  order = 2
 
   end
function p.image(frame)
   local args        = frame:getParent().args or {}
  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['image'] or ''
  local imageUrl    = frame:preprocess('{{filepath:{{PAGENAME:' .. content .. '}}}}')
 
   local html = mw.html.create()
    
    
  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 order-0'):wikitext(header):done()
:tag('div'):addClass('card-header order-0'):wikitext(header):done()
:tag('div'):addClass('card-img' .. tostring(order)):wikitext(content):done()
:tag('div'):addClass('card-img'):attr('data-bg', imageUrl):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 34: Line 40:
:done()
:done()
   :done()
   :done()
  end
 
 
   return html
   return html
end
end


return p
return p

Revision as of 13:21, 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 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['id'] or args['url'] or ''
  
  local html = mw.html.create()
  
  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'):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()

  return html
end

function p.image(frame)
  local args        = frame:getParent().args or {}
  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['image'] or ''
  local imageUrl    = frame:preprocess('{{filepath:{{PAGENAME:' .. content .. '}}}}')
  
  local html = mw.html.create()
  
  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'):attr('data-bg', imageUrl):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()

  return html
end

return p