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

Jump to content

Module:Subject page header

Permanently protected module
From Wikipedia, the free encyclopedia

local p = {}

p.main = function(frame)
	local title = mw.title.getCurrentTitle()
	
	-- Bail out quickly on main namespace
	if title.namespace == 0 then
		return ''
	end

	local pageName = title.fullText
	
	-- Optimization: first check page name suffix before looking up content model
	local isJsonPage = pageName:len() > 5 and pageName:sub(-5) == ".json" and title.contentModel == 'json'

	if isJsonPage then
		local docPageName = pageName:sub(0, -6)
		local docTitle = mw.title.new(docPageName)
		local content = ''
		if docTitle.exists then
			local Hatnote = require('Module:Hatnote')
			content = 
				'<hr>' .. 
				Hatnote._hatnote(
					'The following documentation is located at [['..docPageName..']].<span class="mw-editsection-like plainlinks">[[Special:EditPage/'..docPageName..'|edit]][[Special:PageHistory/'..docPageName..'|history]]</span>'
				) ..
				frame:preprocess(docTitle.content)
		end

		return '<div class="mw-parser-output">' .. content .. '</div>'
	
	elseif title.namespace == 8 and title.contentModel == 'SecurePoll' then
		local Hatnote = require('Module:Hatnote')
		
		return '<div class="mw-parser-output">'..Hatnote._hatnote('This page contains the configuration for a [[m:SecurePoll|SecurePoll]] election. It cannot be directly edited. Any changes must be done via [[Special:SecurePoll]].')..'</div>'
	end
	return ''
end

return p