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

Module:HelpWantedProjects

From Piñata Journal
Revision as of 17:52, 25 January 2026 by Admin Jeremy (talk | contribs) (Created page with "local p = {} local DATA_PAGE = "Template:Help wanted projects/Data" local DEFAULT_LIMIT = 3 function p.main(frame) local limit = tonumber(frame.args.limit) or DEFAULT_LIMIT local title = mw.title.new(DATA_PAGE) if not title or not title.exists then return "<span class='error'>Projects data page missing</span>" end local content = title:getContent() if not content then return "<span class='error'>No project data</span>" end...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

local DATA_PAGE = "Template:Help wanted projects/Data"
local DEFAULT_LIMIT = 3

function p.main(frame)
    local limit = tonumber(frame.args.limit) or DEFAULT_LIMIT

    local title = mw.title.new(DATA_PAGE)
    if not title or not title.exists then
        return "<span class='error'>Projects data page missing</span>"
    end

    local content = title:getContent()
    if not content then
        return "<span class='error'>No project data</span>"
    end

    local items = {}
    for line in content:gmatch("[^\r\n]+") do
        local item = line:match("^%*%s*(.+)")
        if item then
            table.insert(items, item)
        end
    end

    if #items == 0 then
        return ""
    end

    local out = {}
    table.insert(out, "<ul>")
    for i = 1, math.min(limit, #items) do
        table.insert(out, "<li>" .. items[i] .. "</li>")
    end
    table.insert(out, "</ul>")

    return table.concat(out, "\n")
end

return p