Module:DemoTemplate

Hello, you have come here looking for the meaning of the word Module:DemoTemplate. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:DemoTemplate, but we will also tell you about its etymology, its characteristics and you will know how to say Module:DemoTemplate in singular and plural. Everything you need to know about the word Module:DemoTemplate you have here. The definition of the word Module:DemoTemplate will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:DemoTemplate, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


-- ]
require('strict')

local newBuffer = require('Module:OutputBuffer')
local mt = {}

function mt.__index(t, title)
	return function(frame)
		local getBuffer, print, printf = newBuffer()
		printf('{{%s', title)
		local ipairsArgs = {}
		for k,v in ipairs(frame.args) do
			if string.find(v, '=', 1, true) then
				break
			end
			ipairsArgs = true
			printf('|%s', v)
		end
		for k,v in pairs(frame.args) do
			if not ipairsArgs then
				printf('|%s=%s', string.gsub(k, '=', '{{=}}'), v)
			end
		end
		print('}}')
		local buffer = getBuffer()
		-- rather than calling expandTemplate with the title and args we have, call preprocess, so that our code example will always match our output, even in the cases of pipes or other things we should have escaped but didn't
		return string.format('<code>%s</code> &rarr; %s', mw.text.nowiki(buffer), frame:preprocess(buffer))
	end
end

return setmetatable({}, mt)