FANDOM


-- Creates a formatted list from comma separated items.
-- Module author: "The JoTS"
-- <nowiki>
 
local customExists,FORMATS = pcall(require, "Module:List/custom");
local MODES = {
    main = function(str)
        return str .. "<br/>";
    end,
 
    nolist = function(str)
        -- Used for when all formatting operations should be in /custom.
        return str;
    end,
 
    with_links = function(str)
        local link,excess = str:match("^%[%[([^%]]-)%]%](.*)");
 
        return
            link and ("[[" .. link .. "]]" .. excess .. '<br/>')
            or ("[[" .. str .. "]]" .. '<br/>');
    end,
 
    with_bulleted_links = function(str)
        local link,excess = str:match("^%[%[([^%]]+)%]%](.*)");
 
        return
            link and ("\n* [[" .. link .. "]]" .. excess)
            or ("\n* [[" .. str .. "]]");
    end,
 
    with_bullets = function(str)
        return "\n* " .. str;
    end
}
 
local function list(mode)
    return function(frame)
        local list     = frame.args[1];
        local custom   = frame.args[2];
        local args     = { frame.args[3], frame.args[4], frame.args[5] };
 
        local frm_list = list:gsub("([^,]+),?%s*",
            (customExists and custom and custom ~= "")
            and function(str)
                return MODES[mode]( FORMATS[custom](str, args) ); end
            or MODES[mode]);
 
        return frame:preprocess(frm_list);
    end
end
 
return {
    main                = list "main";
    nolist              = list "nolist";
    with_links          = list "with_links";
    with_bulleted_links = list "with_bulleted_links";
    with_bullets        = list "with_bullets";
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.