Module:Demo: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>Codehydro No edit summary |
meta>Codehydro No edit summary |
||
Line 16: | Line 16: | ||
br = br .. '<br>' | br = br .. '<br>' | ||
end | end | ||
if show[frame.args.result_arg] then | if show[show.frame.args.result_arg] then | ||
return show[frame.args.result_arg] | return show[show.frame.args.result_arg] | ||
end | end | ||
return string.format('<pre%s>%s</pre>%s%s', show.frame.args.style and string.format(" style='%s'", show.frame.args.style) or '', show.source, br, show.output) | return string.format('<pre%s>%s</pre>%s%s', show.frame.args.style and string.format(" style='%s'", show.frame.args.style) or '', show.source, br, show.output) |
Revision as of 22:23, 1 January 2015
Documentation for this module may be created at Module:Demo/doc
local p = {}
function p.get(frame, arg)
frame = frame:getParent() or frame
return {
source = mw.text.nowiki(mw.text.unstripNoWiki(frame.args[arg or 1] or '')),
output = frame:preprocess(mw.text.unstripNoWiki(frame.args[arg or 1] or '')),
frame = frame
}
end
function p.main(frame)
local show = p.get(frame)
local br = ''
for k = 1, (show.frame.args.br or 1) do
br = br .. '<br>'
end
if show[show.frame.args.result_arg] then
return show[show.frame.args.result_arg]
end
return string.format('<pre%s>%s</pre>%s%s', show.frame.args.style and string.format(" style='%s'", show.frame.args.style) or '', show.source, br, show.output)
end
return p