Jump to content

Module:NamespaceTable

From Costa Sano KB
Revision as of 21:18, 10 April 2026 by Mngr (talk | contribs) (Created page with "local p = {} function p.table(frame) local pages = frame.args.pages or "" local list = mw.text.split(pages, "\n") local out = '{| class="wikitable"\n! Page !! Description\n' for _, title in ipairs(list) do title = mw.text.trim(title) if title ~= "" then local t = mw.title.new(title) local desc = "" if t and t.exists then -- Get SHORTDESC via page properties local prop...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function p.table(frame)
    local pages = frame.args.pages or ""
    local list = mw.text.split(pages, "\n")

    local out = '{| class="wikitable"\n! Page !! Description\n'

    for _, title in ipairs(list) do
        title = mw.text.trim(title)

        if title ~= "" then
            local t = mw.title.new(title)
            local desc = ""

            if t and t.exists then
                -- Get SHORTDESC via page properties
                local props = mw.title.new(title):getProperties()
                if props and props.shortdesc then
                    desc = props.shortdesc
                end
            end

            out = out .. '|-\n| [[' .. title .. ']] || ' .. desc .. '\n'
        end
    end

    out = out .. '|}'
    return out
end

return p