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

local p = {}

function p.main(frame)
    local args = frame.args
    local rows = {}

    local function row(label, value)
        if value and value ~= "" then
            table.insert(rows,
                string.format("|-\n! %s\n| %s", label, value)
            )
        end
    end

    row("Galaxy", args.galaxy)
    row("Radius", args.radius)
    row("Location", args.location)
    row("Stargate", args.stargate)

    local image = ""
    if args.image and args.image ~= "" then
        image = string.format(
            "|-\n| colspan=\"2\" class=\"infobox-image\" | [[File:%s|250px]]",
            args.image
        )
    end

    local wikitext = string.format([[
{| class="infobox"
%s
|-
| colspan="2" class="infobox-title" | %s
%s
|}
]], image, args.name or frame:getTitle(), table.concat(rows, "\n"))

    -- THIS is the missing step
    return frame:preprocess(wikitext)
end

return p