Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:LinkList

From Teriock

Documentation for this module may be created at Module:LinkList/doc

local p = {}

function p.main(frame)
    local input = frame.args[1]
    if not input or input == "" then
        input = frame:getParent().args[1]
    end

    if not input or input == "" then
        return ""
    end

    local pages = {}

    for page in mw.text.gsplit(input, ';;', true) do
        page = mw.text.trim(page)
        
        if page ~= "" then
            table.insert(pages, page)
        end
    end

    table.sort(pages)

    local output = {}
    
    for _, page in ipairs(pages) do
        table.insert(output, '* [[:' .. page .. ']]')
    end

    return table.concat(output, '\n')
end

return p