Jump to content

Module:CategoryLinks

From Drifters Almanac

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

local p = {}

function p.fromDelimited(frame)
    local input = frame.args[1] or ""
    local delimiter = frame.args.delimiter or ","
    local entries = mw.text.split(input, delimiter)
    local result = {}

    for _, entry in ipairs(entries) do
        local trimmed = mw.text.trim(entry)
        if trimmed ~= "" then
            table.insert(result, string.format("'''[[%s]]'''", trimmed, trimmed))
        end
    end

    return table.concat(result, " • ")
end

return p