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:Subject page header

Permanently protected module
From Wikipedia, the free encyclopedia

local p = {}

-- Invoked from [[MediaWiki:Subjectpageheader-json]]
p.json = function(frame)
	local title = mw.title.getCurrentTitle()
	local pageName = title.fullText
	
	local isJsonPage = pageName:len() > 5 and pageName:sub(-5) == ".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>'	
	end
	return ''
end

-- Invoked from [[MediaWiki:Subjectpageheader-SecurePoll]]
p.SecurePoll = function()
	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 p