Content deleted Content added
The Mol Man (talk | contribs) No edit summary |
Plastikspork (talk | contribs) Remove per this discussion, also there is no "mox" it should have been "moz" so this wasn't doing anything for Mozilla browsers :) |
||
(26 intermediate revisions by 8 users not shown) | |||
Line 2:
local getArgs
local function showUserbox(frame, v, nocat)
local maybeNocat = ''
if nocat then
maybeNocat = '|nocat=yes'
end
return frame:preprocess('{{User '..v..maybeNocat..'}}')
end
function p.main(frame)
Line 7 ⟶ 15:
getArgs = require('Module:Arguments').getArgs
end
local args = getArgs(frame, {
local
:attr('role', 'presentation')
:addClass('userboxes')
:css( {
border = (args.bordercolor or '#99B3FF') .. ' solid ' .. (args.solid or 1)..'px'
} )
local nocat = args.nocat and string.lower(args.nocat) == 'yes'
if args.shadow and string.lower(args.shadow) == 'yes' then
end
local color = args.color or 'inherit'
local row1 =
local row2 =
local row3 =
local body_cells = row2:tag('td')
:css('vertical-align', 'middle !important')
local userboxes
-- Special message for when first argument is blank; otherwise treat it as normal
if args[1] and args[1]:find('%S') then
userboxes = showUserbox(frame, args[1], nocat)
else
userboxes = args.noboxestext or "''You haven't set up any languages. Please see [[Template:Babel/doc]] for help.''"
end
body_cells:wikitext(userboxes)
-- "remove" args[1] so it isn't looked at in the loop
-- table.remove(args,1) doesn't produce desired result
args[1] = ''
-- Keep track of how many columns are in this table
local
for _, v in ipairs( args ) do
-- ! indicates a new cell should be created
if v:find('%S') and
body_cells:wikitext( showUserbox(frame, v, nocat) )
-- Recycling body_cells for <td>
elseif v and v == '!' then
col_span = col_span + 1
body_cells:done()
body_cells = row2:tag('td')
end
end
row1:tag('th')
:css({ ['background-color'] = color,
['text-align'] = 'center' })
:attr('colspan',col_span)
:wikitext( args.header or '[[Wikipedia:Babel]]' )
:done()
row3:tag('td')
:css({ ['background-color'] = color,
['text-align'] = 'center' })
:attr('colspan',col_span)
:wikitext( args.footer or '[[:Category:Wikipedians by language|Search user languages]]' )
:done()
if args['special-boxes'] then
body_cells:wikitext(args['special-boxes'])
end
body_cells:done()
return tostring(ret)
end
|