FANDOM


local p = {}
 
local LINE_COLOUR = '#6699CC'
 
local SOLID = '1px solid ' .. LINE_COLOUR
local DASHED = '1px dashed ' .. LINE_COLOUR
local NONE = 'none'
 
local borders = {
	-- Single lines
	['-'] = { top = NONE, right = SOLID, bottom = NONE, left = SOLID },
	['!'] = { top = SOLID, right = NONE, bottom = SOLID, left = NONE },
	['~'] = { top = NONE, right = DASHED, bottom = NONE, left = DASHED },
	[':'] = { top = DASHED, right = NONE, bottom = DASHED, left = NONE },
	-- Solid
	[','] = { top = NONE, right = SOLID, bottom = SOLID, left = NONE },
	['v'] = { top = NONE, right = SOLID, bottom = SOLID, left = SOLID },
	['.'] = { top = NONE, right = NONE, bottom = SOLID, left = SOLID },
	[')'] = { top = SOLID, right = SOLID, bottom = SOLID, left = NONE },
	['+'] = { top = SOLID, right = SOLID, bottom = SOLID, left = SOLID },
	['('] = { top = SOLID, right = NONE, bottom = SOLID, left = SOLID },
	['`'] = { top = SOLID, right = SOLID, bottom = NONE, left = NONE },
	['^'] = { top = SOLID, right = SOLID, bottom = NONE, left = SOLID },
	['\''] = { top = SOLID, right = NONE, bottom = SOLID, left = NONE },
	-- Dashed
	['F'] = { top = NONE, right = DASHED, bottom = DASHED, left = NONE },
	['V'] = { top = NONE, right = DASHED, bottom = DASHED, left = DASHED },
	['7'] = { top = NONE, right = NONE, bottom = DASHED, left = DASHED },
	['D'] = { top = DASHED, right = DASHED, bottom = DASHED, left = NONE },
	['%'] = { top = DASHED, right = DASHED, bottom = DASHED, left = DASHED },
	['C'] = { top = DASHED, right = NONE, bottom = DASHED, left = DASHED },
	['L'] = { top = DASHED, right = DASHED, bottom = NONE, left = NONE },
	['A'] = { top = DASHED, right = DASHED, bottom = NONE, left = DASHED },
	['J'] = { top = DASHED, right = NONE, bottom = NONE, left = DASHED },
	-- Mixed 1
	['r'] = { top = NONE, right = DASHED, bottom = SOLID, left = NONE },
	['y'] = { top = NONE, right = DASHED, bottom = SOLID, left = DASHED },
	['n'] = { top = NONE, right = NONE, bottom = SOLID, left = DASHED },
	[']'] = { top = SOLID, right = DASHED, bottom = SOLID, left = NONE },
	['#'] = { top = SOLID, right = DASHED, bottom = SOLID, left = DASHED },
	['['] = { top = SOLID, right = NONE, bottom = SOLID, left = DASHED },
	['c'] = { top = SOLID, right = DASHED, bottom = NONE, left = NONE },
	['h'] = { top = SOLID, right = DASHED, bottom = NONE, left = DASHED },
	['j'] = { top = SOLID, right = NONE, bottom = NONE, left = DASHED },
	-- Mixed 2
	['p'] = { top = NONE, right = SOLID, bottom = DASHED, left = NONE },
	['u'] = { top = NONE, right = SOLID, bottom = DASHED, left = SOLID },
	['q'] = { top = NONE, right = NONE, bottom = DASHED, left = SOLID },
	['}'] = { top = DASHED, right = SOLID, bottom = DASHED, left = NONE },
	['*'] = { top = DASHED, right = SOLID, bottom = DASHED, left = SOLID },
	['{'] = { top = DASHED, right = NONE, bottom = DASHED, left = SOLID },
	['b'] = { top = DASHED, right = SOLID, bottom = NONE, left = NONE },
	['t'] = { top = DASHED, right = SOLID, bottom = NONE, left = SOLID },
	['d'] = { top = DASHED, right = NONE, bottom = NONE, left = SOLID },
	[' '] = { top = NONE, right = NONE, bottom = NONE, left = NONE }
}
 
function p.main(frame)
	local args = frame:getParent().args
	local cells = {}
	for i, v in ipairs(args) do
		-- local v_x = mw.text.trim(tostring(v))
                local v_x = v
		if #v_x == 0 then
			v_x = ' '
		end
		cells[i] = v_x
	end
	return p._main(cells)
end
 
function p._main(cells)
	local ret = mw.html.create('table')
			:css({ ['border-spacing'] = '0',
				['line-height'] = '100%' })
	--[[local current_row = mw.html.create('tr')
	for i=1, #cells do
		local v = cells[i]
		if v == '_' then
			local newc = current_row:done()
			ret:node(newc)
			current_row = mw.html.create('tr')
		elseif borders[v] then
			current_row:node(block_cell(borders[v]))
		else
			current_row:node(text_cell(v))
		end
	end
	ret:node(current_row:done())
		:done()--]]
	return ret:done()
end
 
function block_cell(cell)
	local ret = mw.html.create('td')
				:css({ ['margin'] = 0,
					['padding'] = 0 })
 
	local block = mw.html.create('table')
				:css({ ['border-spacing'] = 0,
					['margin'] = 0,
					['padding'] = 0 })
 
	local a1 = mw.html.create('td')
				:css({ ['width'] = '1em',
					['height'] = '1em',
					['border-right'] = cell.top,
					['border-bottom'] = cell.left })
				:wikitext(' ')
				:done()
 
	local a2 = mw.html.create('td')
				:css({ ['width'] = '1em',
					['height'] = '1em' })
				:wikitext(' ')
				:done()
 
	local b1 = mw.html.create('td')
				:css({ ['width'] = '1em',
					['height'] = '1em' })
				:wikitext(' ')
				:done()
 
	local b2 = mw.html.create('td')
				:css({ ['width'] = '1em',
					['height'] = '1em',
					['border-left'] = cell.bottom,
					['border-top'] = cell.right })
				:wikitext(' ')
				:done()
	block	:tag('tr')
			:node(a1)
			:node(a2)
			:done()
		:tag('tr')
			:node(b1)
			:node(b2)
		:done()
	:done()
 
	ret:node(block)
		:done()
 
	return ret
end
 
function text_cell(text)
	local ret = mw.html.create('td')
				:css({ ['border'] = '#DFDFDF',
					['padding'] = '.2em',
					['text-align'] = 'center' })
				:attr('colspan',3)
				:wikitext(text)
				:done()
	return ret
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.