Difference between revisions of "Module:Sandbox/BrandonXLF/2/example"

From blackwiki
Jump to navigation Jump to search
blackwiki>BrandonXLF
blackwiki>BrandonXLF
Line 1: Line 1:
 +
--[[ This module acts like example templates for the parent modules documetaion page ]]--
 +
 
local p = {}
 
local p = {}
  
 
function p.main (frame)
 
function p.main (frame)
 
local args = frame.args
 
local args = frame.args
+
local module = 'Sandbox/BrandonXLF/2'
 
local arguments = {
 
local arguments = {
 
[1]  = '|main|item|, ',
 
[1]  = '|main|item|, ',
Line 18: Line 20:
 
}
 
}
 
 
local out = frame:preprocess('{{#invoke:Sandbox/BrandonXLF/2'..arguments[tonumber(args['EXAMPLE'])]..'}}')
+
local out = frame:preprocess('{{#invoke:'..module..arguments[tonumber(args['EXAMPLE'])]..'}}')
 
 
 
if args['CODE'] then
 
if args['CODE'] then
out = '<pre>'..out..'</pre>'
+
out = '<pre>'..'{{#invoke:'..module..arguments[tonumber(args['EXAMPLE'])]..'}}'..'</pre>'
 
end
 
end
 
 

Revision as of 02:17, 2 January 2019

Documentation for this module may be created at Module:Sandbox/BrandonXLF/2/example/doc

--[[ This module acts like example templates for the parent modules documetaion page ]]--

local p = {}

function p.main (frame)
	local args = frame.args
	local module = 'Sandbox/BrandonXLF/2'
	local arguments = {
		[1]  = '|main|item|, ',
		[2]  = '|main||, ||| and ',
		[3]  = '|main||, |&bull;|&bull;| and ',
		[4]  = '|main|x| & ',
		[5]  = '|main|x| & |item $i: ',
		[6]  = '|bulleted',
		[7]  = '|unbulleted',
		[8]  = '|horizontal',
		[9]  = '|ordered',
		[10] = '|commas',
		[11] = '|list',
	}
	
	local out = frame:preprocess('{{#invoke:'..module..arguments[tonumber(args['EXAMPLE'])]..'}}')
	
	if args['CODE'] then
		out = '<pre>'..'{{#invoke:'..module..arguments[tonumber(args['EXAMPLE'])]..'}}'..'</pre>'
	end
	
	return out

end

return p