Module:Workspace intro
Appearance
local p = {}
function p.build(frame)
local title = ''
local intro = ''
local image = ''
local navigation = ''
local color = '#6af' -- default value
local displaymode = 'normal' -- default value
for key, value in pairs(frame:getParent().args) do -- iterate through arguments, pick out values
if key == 'title' then
title = value
elseif key == 'intro' then
intro = value
elseif key == 'image' then
image = value
elseif key == 'navigation' then
navigation = value
elseif key == 'color' then
color = value
end
end
local current = mw.title.getCurrentTitle()
local current_ns = current.namespace
local current_page = current.text
-- Rendering table of contents and body
local body = ""
-- Adding header
local header = "<div style='display: flex; flex-flow: row wrap;'>" -- top container
header = header .. "<div style='flex: 1 0; border-top: solid .7em " .. color .. ";'>" -- intro
-- Adding project icon
header = header .. "<div class='nomobile' style='float:left; margin-top: 1em; margin-right: 2em; margin-bottom: 1em; text-align: center;'>"
header = header .. image .. "</div>"
-- Adding project title
header = header .. "<div style='font-size: 120%; padding: 0;'>" -- header
header = header .. "<h1 style='font-weight: bold; border-bottom: none; margin:0; padding-top:0.5em;'>" .. title .. "</h1></div>"
-- Adding intro blurb
header = header .. "<div style='margin-top: 1em; padding-bottom: 2em; font-size: 110%;'>"
header = header .. intro .. "</div>"
-- Adding navigation header
if navigation ~= '' then
if mw.title.makeTitle('Template', navigation).exists == true then
header = header .. frame:expandTemplate{ title = 'Template:' .. navigation, args = { } }
end
end
header = header .. "</div>"
-- Adding member box
if mw.title.makeTitle(current_ns, current_page .. '/Members').exists == true
or mw.title.makeTitle(current_ns, current_page .. '/Participants').exists == true then
header = header .. "<div style='flex: 0 1 20em;'>"
header = header .. frame:expandTemplate{ title = 'WPX participants box', args = { } }
header = header .. "</div>"
end
-- Closing off header
header = header .. "</div>"
-- Return header
return header
end
return p