Module:Demo: Difference between revisions

372 bytes added ,  2 years ago
m
1 revision imported
m (1 revision imported)
m (1 revision imported)
 
(One intermediate revision by one other user not shown)
Line 55:
end
return string.format('<pre%s>%s</pre>%s%s', args.style and string.format(" style='%s'", args.style) or '', show.source, args.br, show.output)
end
 
-- Alternate function to return an inline result
function p.inline(frame, demoTable)
local show = demoTable or p.get(frame)
local args = show.frame.args
if show[args.result_arg] then
return show[args.result_arg]
end
return string.format('<code%s>%s</code>%s%s', args.style and string.format(" style='%s'", args.style) or '', show.source, ' → ', show.output)
end