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

From blackwiki
Jump to navigation Jump to search
blackwiki>BrandonXLF
blackwiki>BrandonXLF
(Trying with frame:preprocess)
Line 7: Line 7:
 
 
 
local arguments = {
 
local arguments = {
[1] = {'main','item',', '},
+
[1] = '|main|item|, ',
[2] = {'main','',', ','','',' and '},
+
[2] = '|main||, ||| and ',
[3] = {'main','','•','•',' and '},
+
[3] = '|main||, |•|•| and ',
[4] = {'main','',', ','•','•',' and '},
+
[4] = '|main|x| & ',
[5] = {'main','x',' & '},
+
[5] = '|main|x| & |item $i: ',
[6] = {'bulleted'},
+
[6] = '|bulleted',
[7] = {'unbulleted'},
+
[7] = '|unbulleted',
[8] = {'horizontal'},
+
[8] = '|horizontal',
[9] = {'ordered'},
+
[9] = '|ordered',
[10] = {'commas'},
+
[10] = '|commas',
[11] = {'list'},
+
[11] = '|list',
 
}
 
}
 
 
local out = frame:callParserFunction {
+
local out = frame:preprocess('{{#invoke:Sandbox/BrandonXLF/2'..arguments[exampleNumber]..'}}')
name = '#invoke:Sandbox/BrandonXLF/2',
 
args = arguments[exampleNumber]
 
}
 
 
 
 
if code then
 
if code then

Revision as of 01:52, 2 January 2019

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

local p = {}

function p.main (frame)
	
	local exampleNumber = frame.args.EXAMPLE
	local code = frame.args.CODE
	
	local arguments = {
		[1]  = '|main|item|, ',
		[2]  = '|main||, ||| and ',
		[3]  = '|main||, |•|•| 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:Sandbox/BrandonXLF/2'..arguments[exampleNumber]..'}}')
	
	if code then
		out = '<pre>'..out..'</pre>'
	end
	
	return out

end

return p