Module:Dsize

local p = {} function p.main ( frame ) local gpar = frame.args if mw.ustring.sub(gpar[1], -2) == 'px' then return gpar[1]; else return gpar[1] .. 'px'; end end

-- function: filename function p.f_name ( frame ) local gpar = frame.args		--	globals gpar[1] = gpar[1] or mw.title.getCurrentTitle.text; gpar[2] = gpar[2] or '';	--	"+" value gpar[3] = gpar[3] or '';	--	"-" value local hdr = gpar.h or ''; local trl = gpar.t or ''; local l_strip = 0; local r_strip = 0; if	mw.ustring.lower(mw.ustring.sub (gpar[1],-4,-4)) == '.' then r_strip = 4;			-- .jpg, .png, .svg end

if	mw.ustring.sub (gpar[2],1,1) == "+" then l_strip = tonumber(mw.ustring.sub (gpar[2],2)) end if	mw.ustring.sub (gpar[3],1,1) == "+" then l_strip = tonumber(mw.ustring.sub (gpar[3],2)) end if	mw.ustring.sub (gpar[2],1,1) == "-" then r_strip = r_strip+tonumber(mw.ustring.sub (gpar[2],2)) end if	mw.ustring.sub (gpar[3],1,1) == "-" then r_strip = r_strip+tonumber(mw.ustring.sub (gpar[3],2)) end return 	hdr..mw.ustring.sub (gpar[1], 1+l_strip, mw.ustring.len(gpar[1])-r_strip)..trl end

return p;