本站文本内容除另有声明外,转载时均必须注明出处,并遵守CC BY-NC-SA 3.0协议。(转载须知
本站是中文Minecraft Wiki的镜像站,与Mojang Studios、Weird Gloop没有从属关系。(免责声明

全站通知:

模块:Infobox

来自我的世界地下城WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索
local p = {}

function p.infobox()
	local args = require( 'Module:ProcessArgs' ).merge( true )
	if args['infobox-body-only'] then
		return p.body( args )
	else
		return p.fullInfobox( args )
	end
end

function p.infoboxBody()
	local args = require( 'Module:ProcessArgs' ).merge( true )
	return p.body( args )
end

function p.infoboxRows()
	local args = require( 'Module:ProcessArgs' ).merge( true )
	return p.rows( args )
end

function p.rows( args )
	local footer = args.footer
	if footer then
		footer = '<div class="infobox-footer">' .. footer .. '</div>'
	end
	return table.concat{
		'<div class="infobox-rows">',
		args.rows or '',
		'</div>',
		footer or '',
	}
end

function p.body( args )
	local imageArea = args.imagearea or require( 'Module:Image area' ).main( args )
	local infoboxRows = args['infobox-rows'] or p.rows( args )

	local infoboxBodyLines = {
		imageArea,
		infoboxRows
	}
	return table.concat( infoboxBodyLines, '\n' )
end

function p.fullInfobox( args )
	local title = args.title or mw.title.getCurrentTitle().baseText
	local infoboxTitle = '<div class="mcwiki-header infobox-title">' .. title .. '</div>'
	local infoboxBody = args['infobox-body'] or p.body( args )

	local html = {
		'<div class="notaninfobox tabber-container-infobox">',
		infoboxTitle,
		infoboxBody,
		'</div>'
	}

	return table.concat( html, '\n' )
end

return p