Site notice |
---|
Welcome! Please check To-Do List to see what pages need help, who is working on what, etc.
|
Difference between revisions of "Module:Header"
From Mega Man Wiki
Line 60: | Line 60: | ||
local article_cell = mw.html.create( 'div' ) | local article_cell = mw.html.create( 'div' ) | ||
:css( 'border', '5px solid | :css( 'border', '5px solid black' ) | ||
:css( 'width', '150px' ) | :css( 'width', '150px' ) | ||
:css( 'display', 'inline-block' ) | :css( 'display', 'inline-block' ) | ||
Line 66: | Line 66: | ||
local category_cell = mw.html.create( 'div' ) | local category_cell = mw.html.create( 'div' ) | ||
:css( 'border', '5px solid | :css( 'border', '5px solid black' ) | ||
:css( 'width', '150px' ) | :css( 'width', '150px' ) | ||
:css( 'display', 'inline-block' ) | :css( 'display', 'inline-block' ) | ||
Line 72: | Line 72: | ||
local gallery_cell = mw.html.create( 'div' ) | local gallery_cell = mw.html.create( 'div' ) | ||
:css( 'border', '5px solid | :css( 'border', '5px solid black' ) | ||
:css( 'width', '150px' ) | :css( 'width', '150px' ) | ||
:css( 'display', 'inline-block' ) | :css( 'display', 'inline-block' ) | ||
Line 78: | Line 78: | ||
local quote_cell = mw.html.create( 'div' ) | local quote_cell = mw.html.create( 'div' ) | ||
:css( 'border', '5px solid | :css( 'border', '5px solid black' ) | ||
:css( 'width', '150px' ) | :css( 'width', '150px' ) | ||
:css( 'display', 'inline-block' ) | :css( 'display', 'inline-block' ) | ||
Line 84: | Line 84: | ||
local walkthrough_cell = mw.html.create( 'div' ) | local walkthrough_cell = mw.html.create( 'div' ) | ||
:css( 'border', '5px solid | :css( 'border', '5px solid black' ) | ||
:css( 'width', '150px' ) | :css( 'width', '150px' ) | ||
:css( 'display', 'inline-block' ) | :css( 'display', 'inline-block' ) | ||
Line 90: | Line 90: | ||
local damage_data_cell = mw.html.create( 'div' ) | local damage_data_cell = mw.html.create( 'div' ) | ||
:css( 'border', '5px solid | :css( 'border', '5px solid black' ) | ||
:css( 'width', '150px' ) | :css( 'width', '150px' ) | ||
:css( 'display', 'inline-block' ) | :css( 'display', 'inline-block' ) |
Revision as of 17:51, 5 December 2023
Documentation for this module may be created at Module:Header/doc
local p = {} --p stands for package
function p.header(frame)
-- A passthrough that gets args from the frame and all
mArguments = require('Module:Arguments')
args = mArguments.getArgs(frame)
return p._header(args)
end
function p._header(args, options)
if mw.site.namespaces ~= 100 and args["title"] ~= nil then
gallery_text = "[[Gallery:" .. args["title"] .. "|Gallery]]"
else
gallery_text = "Gallery"
end
if mw.site.namespaces ~= 14 and args["title"] ~= nil then
category_text = "[[:Category:" .. args["title"] .. "|Category]]"
else
category_text = "Category"
end
if mw.site.namespaces ~= 0 and args["title"] ~= nil then
article_text = "[[" .. args["title"] .. "|Article]]"
else
article_text = "Article"
end
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil then
quote_text = "[[" .. args["title"] .. "|Quotes]]"
else
quote_text = "Quotes"
end]==]
quote_text = "Quotes"
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil then
walkthrough_text = "[[" .. args["title"] .. "|Walkthrough]]"
else
quote_text = "Walkthrough"
end]==]
walkthrough_text = "Walkthrough"
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil then
walkthrough_text = "[[" .. args["title"] .. "|Damage_data]]"
else
quote_text = "damage_data"
end]==]
damage_data_text = "Damage data"
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil then
quote_text = "[[" .. args["title"] .. "|Script]]"
else
quote_text = "Script"
end]==]
script_text = "Script"
local article_cell = mw.html.create( 'div' )
:css( 'border', '5px solid black' )
:css( 'width', '150px' )
:css( 'display', 'inline-block' )
:wikitext( article_text )
local category_cell = mw.html.create( 'div' )
:css( 'border', '5px solid black' )
:css( 'width', '150px' )
:css( 'display', 'inline-block' )
:wikitext( category_text )
local gallery_cell = mw.html.create( 'div' )
:css( 'border', '5px solid black' )
:css( 'width', '150px' )
:css( 'display', 'inline-block' )
:wikitext( gallery_text )
local quote_cell = mw.html.create( 'div' )
:css( 'border', '5px solid black' )
:css( 'width', '150px' )
:css( 'display', 'inline-block' )
:wikitext( quote_text )
local walkthrough_cell = mw.html.create( 'div' )
:css( 'border', '5px solid black' )
:css( 'width', '150px' )
:css( 'display', 'inline-block' )
:wikitext( walkthrough_text )
local damage_data_cell = mw.html.create( 'div' )
:css( 'border', '5px solid black' )
:css( 'width', '150px' )
:css( 'display', 'inline-block' )
:wikitext( damage_data_text )
local script_cell = mw.html.create( 'div' )
:css( 'border', '5px solid black' )
:css( 'width', '150px' )
:css( 'display', 'inline-block' )
:wikitext( script_text )
local t = mw.html.create( 'div' )
t:css( 'width', '100%' )
t:css( 'margin-bottom', '0px;')
t:css( 'margin-top', '0px;')
t:css( 'text-align', 'center;')
:wikitext( tostring(article_cell)
.. tostring(category_cell)
.. tostring(gallery_cell)
.. tostring(quote_cell)
.. tostring(walkthrough_cell)
.. tostring(damage_data_cell)
.. tostring(script_cell)
)
return tostring( t )
end
return p