--This page should be deleted, but I assume wikimarkup and templates don't work,so I can't do .--
--Based on the Babel module and the Babel and Babel-N templates.This module is meant to do the same thing as the Babel module,without forcing "User" in front of every argument, while stillallowing for nice table formatting (which Babel-N doesn't!)This is my first time using Lua, but it shouldn't be too hard, right?I think I'll call it "UserlessBabel" or something.--
local p =
local getArgs
local function showBox(frame, v, nocat) local maybeNocat = if nocat then maybeNocat = '|nocat=yes' end return frame:preprocess('')end
function p.main(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end local args = getArgs(frame,)
local ret = mw.html.create('table') :attr('role', 'presentation') :addClass('userboxes') :css
local nocat = args.nocat and string.lower(args.nocat)
if args.shadow and string.lower(args.shadow)
ret:cssText(args['extra-css'] or )
local color = args.color or 'inherit' local row1 = ret:tag('tr') local row2 = ret:tag('tr') local row3 = ret:tag('tr')
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 = showBox(frame, args[1], nocat) else userboxes = args.noboxestext or "You haven't set up any languages. Please see 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 col_span = 1 for _, v in ipairs(args) do -- ! indicates a new cell should be created if v:find('%S') and v ~= '!' then body_cells:wikitext(showBox(frame, v, nocat)) -- Recycling body_cells for
row1:tag('th') :css :attr('colspan',col_span) :wikitext(args.header or '') :done
row3:tag('td') :css :attr('colspan',col_span) :wikitext(args.footer or 'Search user languages') :done
if args['special-boxes'] then body_cells:wikitext(args['special-boxes']) end
body_cells:done
return tostring(ret)end
return p