Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Infobox PrototypeEntity

From starcup wiki
Revision as of 16:57, 23 May 2025 by Little meow meow (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Infobox PrototypeEntity/doc

--------------------------
-- Module for [[Template:Infobox PrototypeEntity]]
------------------------
local p = {}

local infobox = require('Module:Infobox')

function p.main(frame)
	local args = frame:getParent().args
	local ret = infobox.new(args)

	ret:defineParams{
		{ name = 'id', func = 'name' },
		{ name = 'image', func = 'image_no_edit' },
		{ name = 'name', func = 'has_content_alt' },
		{ name = 'description', func = 'has_content_alt' },
		{ name = 'parents', func = 'has_content_alt' },
		{ name = 'abstract', func = 'has_content' },
		{ name = 'source', func = 'has_content' },
	}

	ret:defineLinks({ hide = true })

	ret:create()
	ret:cleanParams()

	ret:customButtonPlacement(true)
	ret:addButtonsCaption()

	ret:defineName('Infobox PrototypeEntity')
	
	ret:addRow( {
		{ tag = 'argh', content = 'id', class='infobox-header', colspan = '20' }
	} )
	:pad(20)
	
	ret:addRow( {
		{ tag = 'argd', content = 'image', colspan = '20', class = 'infobox-full-width-content' }
	} )
	:pad(20)

	ret:addRow{
		{ tag = 'th', content = 'Name', colspan = '8' },
		{ tag = 'argd', content = 'name', colspan = '12' }
	}
	
	ret:addRow{
		{ tag = 'th', content = 'Description', colspan = '8' },
		{ tag = 'argd', content = 'description', colspan = '12' }
	}

	ret:addRow{
		{ tag = 'th', content = 'Parents', colspan = '8' },
		{ tag = 'argd', content = 'parents', colspan = '12' }
	}

	if ret:paramDefined('abstract', 'all') then
		ret:addRow({
			{ tag = 'th', content = 'Abstract', colspan = '8' },
			{ tag = 'argd', content = 'abstract', colspan = '12' },
		})
	end
	
	ret:pad(20)
	ret:addRow({
		{ tag = 'th', content = 'Source', colspan = '8' },
		{ tag = 'argd', content = 'source', colspan = '12' }
	})

--[[
	if onmain() then
		local a1 = ret:param('all')
		local a2 = ret:categoryData()
		ret:wikitext(addcategories(a1, a2))
	end
	return ret:tostring()
]]--

	local a1 = ret:param('all')
	local a2 = ret:categoryData()
	--return ret:wikitext(addcategories(a1, a2))
	return ret:tostring()
end

return p