Module:Babel: Difference between revisions

166 bytes added ,  2 years ago
m
1 revision imported
(updates requested by User:The Mol Man)
 
m (1 revision imported)
 
(2 intermediate revisions by 2 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 10 ⟶ 18:
 
local ret = mw.html.create('table')
:attr('role', 'presentation')
:addClass('userboxes')
:css( {
Line 18 ⟶ 27:
clear = args.align or 'right',
color = args.textcolor or '#000000',
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
ret:css({ ['box-shadow'] = '0 2px 4px rgb(0,0,0,0.2)', })
['-mox-box-shadow'] = '0 2px 4px rgb(0,0,0,0.2)',
['-webkit-box-shadow'] = '0 2px 4px rgb(0,0,0,0.2)' })
end
 
Line 40 ⟶ 49:
-- Special message for when first argument is blank; otherwise treat it as normal
if args[1] and args[1]:find('%S') then
userboxes = frame:preprocessshowUserbox('{{Userframe, '..args[1]..'}}', nocat)
else
userboxes = args.noboxestext or "''You haven't set up any languages. Please see [[Template:Babel/doc]] for help.''"
Line 56 ⟶ 65:
-- ! indicates a new cell should be created
if v:find('%S') and v ~= '!' then
body_cells:wikitext( frame:preprocessshowUserbox('{{Userframe, '..v..'}}', nocat) )
-- Recycling body_cells for <td>
elseif v and v == '!' then
Line 69 ⟶ 78:
['text-align'] = 'center' })
:attr('colspan',col_span)
:wikitext( args.header or '[[Wikipedia:Babel|Conworlds:Babel]]' )
:done()
 
Line 76 ⟶ 85:
['text-align'] = 'center' })
:attr('colspan',col_span)
:wikitext( args.footer or '[[:Category:WikipediansConworlders by language|Search user languages]]' )
:done()