Jump to content

Module:For nowiki

From Simple English Wikipedia, the free encyclopedia
Revision as of 22:38, 20 July 2016 by Petr Matas (talk | changes) (Created page with 'local p = {} function p.main(frame) local args = frame:getParent().args local items = args.code and args or {unpack(args, 2)} local code = mw.text.unstripNoW...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function p.main(frame)
	local args = frame:getParent().args
	local items = args.code and args or {unpack(args, 2)}
	local code = mw.text.unstripNoWiki(args.code or args[1])
	local result = ""
	for i, value in ipairs(items) do
		if args.sep and (i > 1) then
			result = result .. args.sep
		end
		
		result = result .. frame:newChild{args = {value, i = i}}:preprocess(code)
	end
	return result
end

return p