Difference between revisions of "Module:Sandbox/BrandonXLF/2/example"
< Module:Sandbox | BrandonXLF | 2
Jump to navigation
Jump to search
blackwiki>BrandonXLF |
blackwiki>BrandonXLF |
||
| Line 4: | Line 4: | ||
function p.main (frame) | function p.main (frame) | ||
| + | local out = '' | ||
local args = frame.args | local args = frame.args | ||
local module = 'Sandbox/BrandonXLF/2' | local module = 'Sandbox/BrandonXLF/2' | ||
| − | local | + | local wikitext = { |
| − | [1] = '|main|item|, ', | + | [1] = '{{#invoke:Sandbox/BrandonXLF/2|main|item|, }}', |
| − | [2] = '|main||, ||| and ', | + | [2] = '{{#invoke:Sandbox/BrandonXLF/2|main||, ||| and }}', |
| − | [3] = '|main||, |•|•| and ', | + | [3] = '{{#invoke:Sandbox/BrandonXLF/2|main||, |•|•| and }}', |
| − | [4] = '|main|x| & ', | + | [4] = '{{#invoke:Sandbox/BrandonXLF/2|main|x| & }}', |
| − | [5] = '|main|x| & |item $i: ', | + | [5] = '{{#invoke:Sandbox/BrandonXLF/2|main|x| & |item $i: }}', |
| − | [6] = '|bulleted', | + | [6] = '{{#invoke:Sandbox/BrandonXLF/2|bulleted}}', |
| − | [7] = '|unbulleted', | + | [7] = '{{#invoke:Sandbox/BrandonXLF/2|unbulleted}}', |
| − | [8] = '|horizontal', | + | [8] = '{{#invoke:Sandbox/BrandonXLF/2|horizontal}}', |
| − | [9] = '|ordered', | + | [9] = '{{#invoke:Sandbox/BrandonXLF/2|ordered}}', |
| − | [10] = '|commas', | + | [10] = '{{#invoke:Sandbox/BrandonXLF/2|commas}}', |
| − | [11] = '|list', | + | [11] = '{{#invoke:Sandbox/BrandonXLF/2|list}}', |
} | } | ||
| − | |||
| − | |||
if args['CODE'] then | if args['CODE'] then | ||
| − | out = '<pre>'.. | + | out = '<pre>'..wikitext[tonumber(args['EXAMPLE'])]..'</pre>' |
| + | else | ||
| + | out = frame:preprocess(wikitext[tonumber(args['EXAMPLE'])]) | ||
end | end | ||
Revision as of 02:33, 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 out = ''
local args = frame.args
local module = 'Sandbox/BrandonXLF/2'
local wikitext = {
[1] = '{{#invoke:Sandbox/BrandonXLF/2|main|item|, }}',
[2] = '{{#invoke:Sandbox/BrandonXLF/2|main||, ||| and }}',
[3] = '{{#invoke:Sandbox/BrandonXLF/2|main||, |•|•| and }}',
[4] = '{{#invoke:Sandbox/BrandonXLF/2|main|x| & }}',
[5] = '{{#invoke:Sandbox/BrandonXLF/2|main|x| & |item $i: }}',
[6] = '{{#invoke:Sandbox/BrandonXLF/2|bulleted}}',
[7] = '{{#invoke:Sandbox/BrandonXLF/2|unbulleted}}',
[8] = '{{#invoke:Sandbox/BrandonXLF/2|horizontal}}',
[9] = '{{#invoke:Sandbox/BrandonXLF/2|ordered}}',
[10] = '{{#invoke:Sandbox/BrandonXLF/2|commas}}',
[11] = '{{#invoke:Sandbox/BrandonXLF/2|list}}',
}
if args['CODE'] then
out = '<pre>'..wikitext[tonumber(args['EXAMPLE'])]..'</pre>'
else
out = frame:preprocess(wikitext[tonumber(args['EXAMPLE'])])
end
return out
end
return p