Module:Short title/sandbox

local p = {}

local getArgs = require('Module:Arguments').getArgs

function p.main(frame) local args = getArgs(frame, {wrappers = 'Template:Short-title', valueFunc = function(k, v)		if v then			v = mw.text.trim(v)		end		if v ~= '' or k == 'sn' or k == 'm' then			return v		end	end })

if not args.s then return ' Error: No title passed to ' end local retval if false then -- if args.style == 'ref' then -- The original template has an error in its code that prevents this from ever working, so I'm not going to bother converting it for now. --  else if args.c then retval = string.format('%s',				args.s,				args.y or ,				args.a and '#' or ,				args.a or '',				args.c			) else local maybeThe = args.the and 'The ' or '' local maybeComma = args.comma == 'yes' and ',' or '' if args.link then retval = string.format('%s%s%s',					maybeThe,					args.s,					args.y or ,					args.s,					args.y and string.format('%s %s', maybeComma, args.y) or 				) else retval = string.format('%s%s %s',					maybeThe,					args.s,					args.y and string.format('%s %s', maybeComma, args.y) or ''				) end end end if not args.sn or args.sn == 'none' then if args.regnal == 'yes' then retval = string.format('%s (%s%s c.%s)', retval, args.r, args.m, args.chapter) end elseif args.sn == 'cl' then retval = retval .. frame:expandTemplate{title = 'cl-act-title', args = { '',			string.format('%s%s c.%s', args.r, args.m, args.chapter), layout = args.layout or '' }}	elseif args.sn ~= '' then retval = retval .. frame:expandTemplate{title = 'Outside ' .. args.sn, args = { string.format('%s c.%s', args.r, args.chapter) }}	end return retval end

return p