Module:Gaps: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>The Mol Man
No edit summary
meta>The Mol Man
No edit summary
Line 29: Line 29:
local base = parameters['base'] or '10'
local base = parameters['base'] or '10'
ret_string = ret_string..'<span style="margin-left: 0.27em; margin-right: 0.27em">×</span>'..
ret_string = ret_string..'<span style="margin-left: 0.27em; margin-right: 0.27em">×</span>'..
base ..'<span style="display:none">^</span><sup>'..parameters['e']..'</sup>'
base ..'<span style="display:none">^</span><sup>'..string.gsub(parameters['e'],'-','−')..'</sup>'
end
end

Revision as of 18:24, 2 July 2014

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

local p = {}

function p._make(frame)
	local parameters = frame:getParent().args
	local size
	
	if parameters['size'] then
		size = 'font-size:'..parameters['size']..';'
	else
		size = ''
	end
	
	
	local ret_string = '<span style="white-space: nowrap;'..size..'">'
	
	if parameters['lhs'] then
		ret_string = ret_string..parameters['lhs']..' = '
	end
	
	for i=1,20,1 do
		if not parameters[i] then
			break
		else
			ret_string = ret_string..'<span style="margin-left: 0.2em">'..parameters[i]..'</span>'
		end
	end
	
	if parameters['e'] then
		local base = parameters['base'] or '10'
		ret_string = ret_string..'<span style="margin-left: 0.27em; margin-right: 0.27em">×</span>'..
					base ..'<span style="display:none">^</span><sup>'..string.gsub(parameters['e'],'-','−')..'</sup>'
	end
	
	if parameters['u'] then
		ret_string = ret_string..'&nbsp;'..parameters['u']
	end
	
	return ret_string
end

return p