Difference between revisions of "Module:Based on/sandbox"

From blackwiki
Jump to navigation Jump to search
blackwiki>Nardog
blackwiki>Nardog
Line 2: Line 2:
  
 
function p._main(args)
 
function p._main(args)
local s = args[1]
+
return args[3] and string.format(
if args[3] then
+
'%s <br /><span style="vertical-align:top">by </span><div class="plainlist" style="display:inline-block">\n* %s</div>',
local h = mw.html.create('ul')
+
args[1],
for i, v in ipairs(args) do
+
table.concat(args, '\n* ', 2)
if i ~= 1 then
+
)
h:tag('li'):wikitext(v):done()
+
or args[2] and string.format(
end
+
'%s <span style="display:inline-block">by %s</span>',
end
+
args[1],
h = mw.html.create()
+
args[2]
:wikitext(s .. ' ')
+
)
:tag('br')
+
or args[1]
:done()
 
:tag('span')
 
:css('vertical-align', 'top')
 
:wikitext('by ')
 
:done()
 
:tag('div')
 
:addClass('plainlist')
 
:css('display', 'inline-block')
 
:node(h)
 
:allDone()
 
s = h
 
elseif args[2] then
 
s = string.format('%s <span style="display:inline-block">by %s</span>',
 
s, args[2])
 
end
 
return s
 
 
end
 
end
  
 
function p.main(frame)
 
function p.main(frame)
return p._main(frame:getParent().args)
+
return p._main(mw.clone(frame:getParent().args))
 
end
 
end
  
 
return p
 
return p

Revision as of 20:45, 21 January 2020

Documentation for this module may be created at Module:Based on/sandbox/doc

local p = {}

function p._main(args)
	return args[3] and string.format(
			'%s <br /><span style="vertical-align:top">by </span><div class="plainlist" style="display:inline-block">\n* %s</div>',
			args[1],
			table.concat(args, '\n* ', 2)
		)
		or args[2] and string.format(
			'%s <span style="display:inline-block">by %s</span>',
			args[1],
			args[2]
		)
		or args[1]
end

function p.main(frame)
	return p._main(mw.clone(frame:getParent().args))
end

return p