Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Logoform: Difference between revisions

From Neodyland Wiki
Blanked the page
m Reverted edits by 197.120.162.43 (talk) to last revision by Sarang
Line 1: Line 1:
local p = {}  --  Module for: Formatting Logo


function p.format (frame)
local gpar = frame.args -- global
local file = 'F' -- assume file
local size = gpar[2] or '0' -- "0" for "unspecified"
local styl = ';'..gpar[3] or '-' -- "unspecified"
local titl = '">' -- no title
if  mw.ustring.sub(size, -2) == 'px' then
size = mw.ustring.sub(size, 1, #size-2 )
end
if not mw.ustring.find( gpar[1], '.', 1, true ) then
if mw.ustring.sub ( gpar[1], 1, 2 ) == 'U+' or
mw.ustring.sub ( gpar[1], 1, 2 ) == '&#' then
file = 'U'
if mw.ustring.sub( gpar[1], 1, 2 ) == 'U+' then -- standardize:
titl = '" title='..gpar[1]..'>'
gpar[1] = mw.ustring.gsub( gpar[1]..';', 'U%+', '&#x' ),_
elseif
mw.ustring.sub( gpar[1], 1, 3 ) == '&#;' then -- textstring:
gpar[1] = mw.ustring.sub( gpar[1], 4 )
end
if styl == ';-' then styl = ';' end -- not specified
if size ~= '0' then
local stab = mw.text.split( size, 'x' )
size = stab[1]
if stab[2] then size = stab[2] end -- height
else
size = '33' -- Unicode default size
end
end
else
if size == '0' then
size = '36x22' -- File default size
end
end
if file == 'F' then
return '[[File:'..gpar[1]..'|'..size..'px]]' -- allow linking
else
return '<span style="font-size:'..size..'px;vertical-align:middle'..styl..titl..gpar[1]..'</span>'
end
end -- function format
return p

Revision as of 19:31, 1 October 2022

Module documentation[ create · purge ]
This documentation is transcluded from Module:Logoform/doc.
local p = {}   --  Module for: Formatting Logo

function p.format (frame)
	local gpar = frame.args		--	global
	local file = 'F'			--	assume file
	local size = gpar[2] or '0'	--	"0" for	"unspecified"
	local styl = ';'..gpar[3] or '-'	--	"unspecified"
	local titl = '">'			-- no title
	if  mw.ustring.sub(size, -2) == 'px' then
		size = mw.ustring.sub(size, 1, #size-2 )
	end
	if	not mw.ustring.find( gpar[1], '.', 1, true ) then
		if	mw.ustring.sub ( gpar[1], 1, 2 ) == 'U+'	or
			mw.ustring.sub ( gpar[1], 1, 2 ) == '&#'	then
			file = 'U'
			if	mw.ustring.sub( gpar[1], 1, 2 ) == 'U+' then	--	standardize:
				titl = '" title='..gpar[1]..'>'
				gpar[1] = mw.ustring.gsub( gpar[1]..';', 'U%+', '&#x' ),_ 
			elseif
				mw.ustring.sub( gpar[1], 1, 3 ) == '&#;' then	--	textstring: 	
				gpar[1] = mw.ustring.sub( gpar[1], 4 )
			end
			if	styl == ';-' then styl = ';' end	--	not specified
			if	size ~= '0' then
				local stab = mw.text.split( size, 'x' )
				size = stab[1]
				if stab[2] then size = stab[2] end	--	height
			else
				size = '33'		--	Unicode default size
			end
		end
	else
		if	size == '0'	then
			size = '36x22'		--	File default size
		end
	end

	if file == 'F' then 
		return '[[File:'..gpar[1]..'|'..size..'px]]'	-- allow linking
	else
		return '<span style="font-size:'..size..'px;vertical-align:middle'..styl..titl..gpar[1]..'</span>'
	end	
end -- function format

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.