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: a22903b7fdf3258a

Jump to content

Module:Sandbox/FlammablePizza

From Wikipedia, the free encyclopedia
local p = {}

local priority = {
    ["ambox-notice"] = 1,
    ["ambox-style"] = 2,
    ["ambox-content"] = 3,
    ["ambox-move"] = 4,
    ["ambox-protection"] = 5,
    ["ambox-delete"] = 6,
    ["ambox-speedy"] = 7,

	["cmbox-notice"] = 1,
    ["cmbox-style"] = 2,
    ["cmbox-content"] = 3,
    ["cmbox-move"] = 4,
    ["cmbox-protection"] = 5,
    ["cmbox-delete"] = 6,
    ["cmbox-speedy"] = 7,

	["imbox-notice"] = 1,
    ["imbox-style"] = 2,
    ["imbox-content"] = 3,
    ["imbox-move"] = 4,
    ["imbox-protection"] = 5,
    ["imbox-delete"] = 6,
    ["imbox-speedy"] = 7,

    ["ombox-notice"] = 1,
    ["ombox-style"] = 2,
    ["ombox-content"] = 3,
    ["ombox-move"] = 4,
    ["ombox-protection"] = 5,
    ["ombox-delete"] = 6,
    ["ombox-speedy"] = 7,

	["tmbox-notice"] = 1,
    ["tmbox-style"] = 2,
    ["tmbox-content"] = 3,
    ["tmbox-move"] = 4,
    ["tmbox-protection"] = 5,
    ["tmbox-delete"] = 6,
    ["tmbox-speedy"] = 7,
}

function p.main(frame)
    local html = frame:preprocess(frame.args[1] or "")

    local highest
    local score = 0

    for class, value in pairs(priority) do
        if html:find(class, 1, true) and value > score then
            highest = class
            score = value
        end
    end

    return highest and highest:gsub("^[aciot]mbox%-", "") or "content"
end

return p