Module:History

From Vintage Story Wiki
Revision as of 15:57, 20 August 2022 by Sana (talk | contribs)

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

local p = {}

function p.create(f)
	local args = require( 'Module:ProcessArgs' ).merge( true )
	
	local parentVer
	for str in string.gmatch( args[1], '(.*)%-' ) do
		parentVer = str
	end
	local childVer = args[1]
	local header = mw.html.create('th')
		:attr( 'colspan', '3')
		:wikitext('History')
	
	local parent = mw.html.create('td')
		:css('width', '20%')
		:wikitext('[[' .. parentVer .. ']]')
		
	local child = mw.html.create('td')
		:css('width', '20%')
		:wikitext('[[' .. childVer .. ']]')
		
	local notes = mw.html.create('td')
		:css('width', '60%')
		:wikitext(args[2])
	
	local body = mw.html.create('table'):attr('class', 'wikitable')
		:css('border', '1px solid black')
	if args.header then
		body
			:node(header):done()
	end
	body
		:tag('tr')
			:node(parent):done()
			:node(child):done()
			:node(notes):done()
	
	return body
end
return p