Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21ee3fd0e277089

Jump to content

Module:Sandbox/Greenbreen/PPP

From Wikipedia, the free encyclopedia
local data = require("Module:Sandbox/Greenbreen/PPP/data")

local p = {}

local function getPPP(country, year)
    local c = data[country]
    if not c then return nil end

    year = tonumber(year) or 2016
    return c[year]
end

function p.convert(value, country, year)
    value = tonumber(value)
    if not value or not country then return nil end

    local ppp = getPPP(country, year)
    if not ppp then return nil end

    return value / ppp
end

-- wrapper for template use
function p.convertFrame(frame)
    local args = frame:getParent().args
    local result = p.convert(args[1], args[2], args[3] or args.year)

    if not result then
        return "Error: PPP conversion failed"
    end

    return result
end

return p