Module:Demo: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Codehydro
No edit summary
meta>Codehydro
mNo edit summary
Line 3: Line 3:
function p.main(frame)
function p.main(frame)
frame = frame:getParent() or frame
frame = frame:getParent() or frame
local code = mw.text.unstripNoWiki(frame.args[1] or '')
local code = mw.text.nowiki(mw.text.unstripNoWiki(frame.args[1] or ''))
local template = frame:preprocess(mw.text.unstripNoWiki(frame.args[1] or ''))
local template = frame:preprocess(mw.text.unstripNoWiki(frame.args[1] or ''))
local br = ''
local br = ''

Revision as of 18:55, 31 December 2014

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

local p = {}

function p.main(frame)
	frame = frame:getParent() or frame
	local code = mw.text.nowiki(mw.text.unstripNoWiki(frame.args[1] or ''))
	local template = frame:preprocess(mw.text.unstripNoWiki(frame.args[1] or ''))
	local br = ''
	for k = 1, (frame.args.br or 1) do
		br = br .. '<br>'
	end
	return string.format('<pre%s>%s</pre>%s%s', frame.args.style and string.format(" style='%s'", frame.args.style) or '', code, br, template)
end

return p