Module:Administrators' noticeboard archives/sandbox explained

local archiveList = require('Module:Archive list')

-- Gets wikitable rows filled with archive links, using .local function getLinks(funcArgs) if type(funcArgs) ~= 'table' then error('Invalid input to getLinks', 2) end funcArgs.sep = '

  • ' funcArgs.links = 20 funcArgs.linesep = ' ' -- hacking around the wrapper to remove lineseparators return mw.ustring.format('
    1. %s
    ', archiveList.main(funcArgs))end

    -- Returns a Lua table with value being a list of archive links for one of the-- noticeboards listed in the archives table at the top of the module.local function getLinksTable(all)

    -- A table of the archives to display. local archives = local t = for board, archive in pairs(archives) do local funcArgs = archive if not all then local archiveMax = archiveList.count(funcArgs) if type(archiveMax)

    'number' and archiveMax >= 0 then funcArgs.max = math.floor(archiveMax) local start = funcArgs.max -19 if start < 1 then start = 1 end funcArgs.start = start end end t[board] = getLinks(funcArgs) end return tend

    local function group (main_page, search, list) local ret = mw.html.create('li') ret:tag('div') :addClass('an-archives-header') :wikitext(main_page .. " ") :tag('span') :wikitext(search) :done :done ret:wikitext(list) :allDone return retend

    -- Build the wikitable using mw.ustring.format.local function buildWikitable(args) local t = getLinksTable(args.all) local frame = mw.getCurrentFrame local lists = -- optional since these haven't been used in a while if args.csn

    'yes' then table.insert(lists, group("Community sanction archives", "(search)", t.csn )) end local other_links = mw.html.create('li') other_links:tag('div') :addClass('an-archives-header') :wikitext('Other links') :done :wikitext(require('Module:List').horizontal) :allDone table.insert(lists, other_links) local list = mw.html.create('ul') for _, group in ipairs(lists) do list:node(group) end list:allDone local box = mw.html.create('div') box:addClass('an-archives') :tag('div') :addClass('an-archives-caption') :wikitext('Noticeboard archives') :done :node(list)

    if args.search

    'yes' then box:tag('div') :addClass('an-archives-search') :wikitext(frame:preprocess([==[ <inputbox> bgcolor=transparent type=fulltext prefix=Wikipedia:Administrators' noticeboard break=no width=32 searchbuttonlabel=Search placeholder=Search noticeboards archives </inputbox>]

    ] )) end box:allDone return frame:extensionTag .. '__NOINDEX__' .. tostring(box)

    end

    function makeWrapper(all) return function(frame) -- If we are being called from #invoke, get the args from #invoke -- if they exist, or else get the arguments passed to the parent -- frame. Otherwise, assume the arguments are being passed directly -- in from another module or from the debug console. local origArgs if frame