Site notice
Welcome! Please check To-Do List to see what pages need help, who is working on what, etc.

Module:Header

From Mega Man Wiki

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 
	local gallery_cell
	local walkthrough_cell
	local damage_data_cell
	local quote_cell
	local script_cell
	local category_cell
	local t
	
    if args["links-only"] ~= nil and args["links-only"] == "yes" then
		article_cell = mw.html.create( 'span' )
	     :wikitext( article_text )
	     
	     gallery_cell = mw.html.create( 'span' )
	     :wikitext( gallery_text )
	     
	    walkthrough_cell = mw.html.create( 'span' )
	     :wikitext( walkthrough_text )
	     
	    damage_data_cell = mw.html.create( 'span' )
	     :wikitext( damage_data_text )
	     
	    quote_cell = mw.html.create( 'span' )
	     :wikitext( quote_text )
	     
	    script_cell = mw.html.create( 'span' )
	     :wikitext( script_text )
	     
	     category_cell = mw.html.create( 'span' )
	     :wikitext( category_text )
		
		if args["subtype"] ~= nil and args["subtype"] == "game" then
	        t = mw.html.create( 'span' )
	        	:wikitext( tostring(article_cell) .. " • "
	          	.. tostring(gallery_cell) .. " • "
	            .. tostring(walkthrough_cell) .. " • "
	          	.. tostring(damage_data_cell) .. " • "
	          	.. tostring(script_cell) .. " • "
	          	.. tostring(category_cell) 
	          	)  
     else 
	        t = mw.html.create( 'span' )
	        	:wikitext( tostring(article_cell)  .. " • "
          	.. tostring(gallery_cell) .. " • "
            .. tostring(walkthrough_cell) .. " • "
          	.. tostring(quote_cell) 
          	)
		end
	else 
		article_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( article_text )
	     
	     gallery_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( gallery_text )
	     
	    walkthrough_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( walkthrough_text )
	     
	    damage_data_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( damage_data_text )
	     
	    quote_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( quote_text )
	     
	    script_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( script_text )
	     
	     category_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( category_text )
     
     if args["subtype"] ~= nil and args["subtype"] == "game" then
        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(gallery_cell) 
            .. tostring(walkthrough_cell) 
          	.. tostring(damage_data_cell) 
          	.. tostring(script_cell) 
          	.. tostring(category_cell) 
          	)  
     else 
      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(gallery_cell) 
            .. tostring(walkthrough_cell) 
          	.. tostring(quote_cell) 
          )
     end
         end
return tostring( t )
end	

return p