Jump to content

Module:Sandbox/Galobtter

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Galobtter (talk | contribs) at 16:45, 31 March 2018 (hm). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
function p.main(frame)
	args = require('Module:Arguments').getArgs(frame)
	name = args.name
	start = args.start
	last = args.last
	local text = args.logic
	text = string.gsub(text, '{%-', '{{')
	text = string.gsub(text, '%-}', '}}')
	text = string.gsub(text, '!', '|')
	local out = {}
	for i = start, last do
		n = 1
		local datanum = tostring(i)
		local strings = string.gmatch(text, '(%a+)%$')
		local finaltext = string.gsub(text, '%a+%$', '{{{'..strings() or ''..tostring(n)..'|}}}')
		table.insert(out, name..tostring(i)..'= '..frame:getParent():preprocess(finaltext)..'|')
		n = n + 1
	end
	return table.concat(out)
end
return p