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.

Jump to content

Module:User:Anomie/Sandbox

From Wikipedia, the free encyclopedia
local p = {}

local t = os.time()

function p.bug66798( frame )
    return frame:getParent():getTitle()
end

function p.bug71971( frame )
    local a = mw.clone( frame.args )
    return frame:expandTemplate{ title='User:Anomie/Sandbox2', args=a }
end

function p.bug71971_2( frame )
    local m = ''
    for k, v in pairs( frame:getParent().args ) do
        m = m .. tostring(k) .. ' = ' .. tostring(v) .. "\n"
    end
    return '<pre>' .. m .. '</pre>'
end

local function error3( txt )
    error( txt )
end

local function error2( txt )
    error3( txt )
end

function p.error( frame )
    error2( frame.args[1] );
end

function p.log( frame )
    mw.log( frame.args[1] );
end

local cf = mw.getCurrentFrame();
function p.testJunk( frame )
    return '<pre>\n' .. mw.dumpObject( mw.getCurrentFrame() ) .. '\n</pre>\n' ..
        '<pre>\n' .. mw.dumpObject( cf ) .. '\n</pre>\n';
end


function p.testParents( frame )
    local ret = {};
    local f = frame;
    while f do
        table.insert( ret, f:getTitle() );
        f = f:getParent();
    end
    table.insert( ret, '--' );
    local f = cf;
    while f do
        table.insert( ret, f:getTitle() );
        f = f:getParent();
    end

    return '<pre>\n' .. table.concat( ret, "\n" ) .. '\n</pre>\n';
end

function p._suppressTemplatestyles( text )
	local ret = string.gsub( text, '\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127', '' )
	return ret
end

function p.suppressTemplatestyles( frame )
	return p._suppressTemplatestyles( frame.args[1] )
end

return p