Module:Babel: Difference between revisions
From Test Wiki
Content deleted Content added
updates requested by User:The Mol Man |
+nocat parameter; request by Andrybak |
||
| Line 2: | Line 2: | ||
local getArgs |
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) |
function p.main(frame) |
||
| Line 20: | Line 28: | ||
border = (bordercolor or '#99B3FF') .. ' solid ' .. (args.solid or 1)..'px' |
border = (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 |
if args.shadow and string.lower(args.shadow) == 'yes' then |
||
| Line 40: | Line 50: | ||
-- Special message for when first argument is blank; otherwise treat it as normal |
-- Special message for when first argument is blank; otherwise treat it as normal |
||
if args[1] and args[1]:find('%S') then |
if args[1] and args[1]:find('%S') then |
||
userboxes = |
userboxes = showUserbox(frame, args[1], nocat) |
||
else |
else |
||
userboxes = args.noboxestext or "''You haven't set up any languages. Please see [[Template:Babel/doc]] for help.''" |
userboxes = args.noboxestext or "''You haven't set up any languages. Please see [[Template:Babel/doc]] for help.''" |
||
| Line 56: | Line 66: | ||
-- ! indicates a new cell should be created |
-- ! indicates a new cell should be created |
||
if v:find('%S') and v ~= '!' then |
if v:find('%S') and v ~= '!' then |
||
body_cells:wikitext( |
body_cells:wikitext( showUserbox(frame, v, nocat) ) |
||
-- Recycling body_cells for <td> |
-- Recycling body_cells for <td> |
||
elseif v and v == '!' then |
elseif v and v == '!' then |
||