Difference between revisions of "Module:Sandbox"

From Raft Wiki
Jump to: navigation, search
m
 
Line 20: Line 20:
 
else
 
else
 
if phase == 0 then
 
if phase == 0 then
table.insert( components, '<div class="componentsimage" width="64px">[[File:'..component..'.png|center|48px|link='..component..']]</div></td><td class="components" style="padding:0;"><div style="font-size:115%;"><b>[['..component..']]</b>')
+
table.insert( components, '<div class="componentsimage" width="64px">[[File:'..component..'.png|center|48px|link='..component..']]</div></td><td style="padding:0;"><div style="font-size:115%;" class="components"><b>[['..component..']]</b>')
 
else
 
else
 
table.insert( components, '<span style="float: right; padding: 0 15px 0 9px;"><b>'..component..'</b></span></div>')
 
table.insert( components, '<span style="float: right; padding: 0 15px 0 9px;"><b>'..component..'</b></span></div>')

Latest revision as of 10:19, 8 May 2021

Raft Wiki:Sandbox Template:Sandbox Module:Sandbox

--[[ TEST]]
local phase = 0
local styleValue = ''
local link = ''
local linkEnd = ''
local textOutput = ''
local p = {}
	function p.main( f )

		local args = f
		if f == mw.getCurrentFrame() then
			args = f:getParent().args
		end
		local items = args[1] or ''
	
		local components = {}
		for component in mw.text.gsplit( items, '%s*;%s*' ) do
			if component == '' then
				table.insert( components, '<span><br></span>' )
			else
				if phase == 0 then
					table.insert( components, '<div class="componentsimage" width="64px">[[File:'..component..'.png|center|48px|link='..component..']]</div></td><td style="padding:0;"><div style="font-size:115%;" class="components"><b>[['..component..']]</b>')
				else
					table.insert( components, '<span style="float: right; padding: 0 15px 0 9px;"><b>'..component..'</b></span></div>')
				end
				--table.insert( components, '<span class="component" style="' .. styleValue .. '">'..textOutput..'</span>' )
				phase = phase + 1
			end
		end
		components[1] = components[1]:gsub( '^<span>', '<span class="componentsimage">' )
		
		return '<div class="clist" style="font-size:115%">' .. table.concat( components ) .. '</div>'
	end
return p