Difference between revisions of "Module:Demo"
From MINR.ORG WIKI
| Line 8: | Line 8: | ||
frame = frame | frame = frame | ||
} | } | ||
| − | if | + | if result[frame.result_arg] then |
| − | return result[ | + | return result[frame.result_arg] |
end | end | ||
return result | return result | ||
Revision as of 23:02, 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
local result = {
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
}
if result[frame.result_arg] then
return result[frame.result_arg]
end
return result
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
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