Module:User:Mr. Stradivarius/BannerConvert explained

local dts = require('Module:User:Anomie/deepToString').deepToString -- for debugging

local p =

local basicDisplayParams =

-- Replaces bar characters with a pseudo-random string for converting back later.local function debar(s) local s = mw.ustring.gsub(s, '|', 'DEBARRED-29vuy7dsgtz87465gfbq29gr1bzj-DERRABED') return send

-- Undoes the transformation done by debar.local function rebar(s) local s = mw.ustring.gsub(s, 'DEBARRED%-29vuy7dsgtz87465gfbq29gr1bzj%-DERRABED', '|') return send

-- Returns a table containing the numbers of the arguments that exist for the specified prefix and suffix.local function getArgNums(t, prefix, suffix) if type(t) ~= 'table' then return nil end prefix = type(prefix)

'string' and prefix or suffix = type(suffix)

'string' and suffix or local nums = for k, v in pairs(t) do if mw.ustring.find(v, '%S') then local num = tostring(k) num = mw.ustring.match(num, '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$') if num then table.insert(nums, tonumber(num)) end end end table.sort(nums) return numsend

local function getAliasNames(s, t) if type(s) ~= 'string' then return end local t = t or for tripleBraces in mw.ustring.gmatch(s, '') do tripleBraces = mw.ustring.sub(tripleBraces, 4, -4) local alias, default = mw.ustring.match(tripleBraces, '^(.-)|(.*)$') if not alias then alias = tripleBraces end table.insert(t, mw.text.trim(alias)) if default then getAliasNames(default, t) end end return tend

-- Searches a string for the first instance of the specified template, and returns a table with the template arguments.local function getTemplateArgs(s, templateName) if type(s) ~= 'string' or type(templateName) ~= 'string' or #templateName

0 then return nil end -- Process the template name so that we can match both upper case and lower case for the first character. local firstLetter, lastLetters if #templateName

1 then firstLetter, lastLetters = templateName, else firstLetter, lastLetters = mw.ustring.sub(templateName, 1, 1), mw.ustring.sub(templateName, 2, -1) end local pattern = mw.ustring.format('^