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: Difference between revisions

From starcup wiki
No edit summary
No edit summary
Line 16: Line 16:
{ name = 'description', func = 'has_content' },
{ name = 'description', func = 'has_content' },
{ name = 'parent', func = 'has_content' },
{ name = 'parent', func = 'has_content' },
{ name = 'abstract', func = 'has_content' },
{ name = 'source', func = 'has_content' },
{ name = 'source', func = 'has_content' },
}
}
Line 59: Line 60:
{ tag = 'argd', content = 'source', colspan = '12' }
{ tag = 'argd', content = 'source', colspan = '12' }
})
})
if ret:paramDefined('abstract', 'all') then
ret:addRow({
{ tag = 'th', content = 'Abstract', colspan = '8' },
{ tag = 'argd', content = 'abstract', colspan = '12' },
})
end


--[[
--[[

Revision as of 00:59, 17 May 2025

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' },
		{ name = 'name', func = 'has_content' },
		{ name = 'description', func = 'has_content' },
		{ name = 'parent', func = 'has_content' },
		{ 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 = 'Parent', colspan = '8' },
		{ tag = 'argd', content = 'parent', colspan = '12' }
	}
	ret:pad(20)
	
	ret:addRow({
		{ tag = 'th', content = 'Source', colspan = '8' },
		{ tag = 'argd', content = 'source', colspan = '12' }
	})

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

--[[
	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