Jump to content

Module:Based on and Module:Based on/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
Include space
 
No edit summary
 
Line 1: Line 1:
local p = {}
local p = {}


function p.lua_main(frame)
function p._main(args)
local s = frame.args[1]
local s = args[1]
if args[2] then
s = mw.html.create()
if frame.args[3] then
local args = {}
:wikitext(s .. ' ')
:tag('br')
:done()
for i, v in ipairs(frame.args) do
:tag(args[3] and 'div' or 'span')
if i >= 2 then
:addClass('nowrap')
args[#args+1] = v
:tag('span')
end
:css('vertical-align', 'top')
end
:wikitext('by ')
:done()
args['style'] = 'display: inline'
args['list_style'] = 'display: inline'
:tag(args[3] and 'div' or 'span')
:addClass('wrap')
args['item1_style'] = 'display: inline'
:addClass(args[3] and 'plainlist')
:css('display', 'inline-block')
h = mw.html.create('div')
-- Prevents the text from spilling out
h:wikitext(s)
:css('padding-right', '1.25em')
h:tag('br') -- h:newline() is not working for some reason
h:wikitext('by ')
:wikitext(args[3] and
'\n* ' .. table.concat(args, '\n* ', 2) .. '\n'
h:wikitext(frame:expandTemplate{ title = 'Unbulleted list', args = args })
or args[2])
:done()
return h
:done()
elseif frame.args[2] then
s = s .. '<br />by ' .. frame.args[2]
return s
end
end
return s
return s
end
end


function p.main(frame)
function p.main(frame)
-- mw.clone makes table.concat possible
return p.lua_main(frame:getParent())
return p._main(mw.clone(frame:getParent().args))
end
end