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 header = '{| class="wikitable">!colspan="3"|History|-'
local header = '{| class="wikitable"\n!colspan="3"|History\n|-\n'
if args.header then
if args.header then
Line 21: Line 21:
local child = '||[[' .. childVer .. ']]'
local child = '||[[' .. childVer .. ']]'
local notes = '||' .. args[2]
local notes = '||' .. args[3]
local parent
local parent
Line 27: Line 27:
if parentVer then
if parentVer then
parent = '|[[' .. parentVer .. ']]'
parent = '|[[' .. parentVer .. ']]'
body =  parent .. child .. notes
body =  parent .. child .. notes .. '\n'
else
else
body = '|' .. child .. notes
body = '|' .. child .. notes .. '\n'
end
end

Revision as of 16:18, 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 header = '{| class="wikitable"\n!colspan="3"|History\n|-\n'
		
	if args.header then
		return header
	end
	
	local footer = '|}'
	
	if args.footer then
		return footer
	end
	
	local parentVer = args[1] or ''
	local childVer = args[2]
	
	local child = '||[[' .. childVer .. ']]'
		
	local notes = '||' .. args[3]
	
	local parent
	local body
	if parentVer then
		parent = '|[[' .. parentVer .. ']]'
		body =  parent .. child .. notes .. '\n'
	else
		body = '|' .. child .. notes .. '\n'
	end
	
	return body
end
return p