Module:History: Difference between revisions

From Vintage Story Wiki
mNo edit summary
mNo edit summary
Line 4: Line 4:
local args = require( 'Module:ProcessArgs' ).merge( true )
local args = require( 'Module:ProcessArgs' ).merge( true )
local parentVer = string.gmatch( args[1], '(.*)%-' )
local parentVer
for str in string.gmatch( args[1], '(.*)%-' ) do
parentVer = str
end
local childVer = args[1]
local childVer = args[1]
local header = mw.html.create('th'):wikitext('History')
local header = mw.html.create('th'):wikitext('History')

Revision as of 15:46, 20 August 2022

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'):wikitext('History')
	
	local parent = mw.html.create('td')
	parent
		:css('width', '20%')
		:wikitext('[[' .. parentVer .. ']]')
		
	local child = mw.html.create('td')
	child
		:css('width', '20%')
		:wikitext('[[' .. childVer .. ']]')
	
	local body = mw.html.create('table')
	body
		:css('border', '1px solid black')
		:tag('tr')
			:node(header)
			:node(parent)
			:node(child)
		:done()
	
	return body
end
return p