Jump to content

Module:Globalrenamequeue-summary-request-note

Permanently protected module
From Meta, a Wikimedia project coordination wiki
Module documentation
--[[
Copyright (c) 2019 rxy < https://rxy.jp/ >
License: The MIT License (MIT)
License detail: https://opensource.org/licenses/MIT
]]

local p = {}

function p.main( frame )
	local pageName = frame.args[1]
	local specialPagenameFull = 'Special:GlobalRenameQueue/request/'
	local basePageName = 'GlobalRenameQueue/Notes/'

	if #pageName <= #specialPagenameFull then return end

	local queueID = pageName:sub( #specialPagenameFull + 1 )
	local checkSlash = queueID:find( '/' )

	if checkSlash then
		queueID = string.sub( queueID, 0, checkSlash - 1 )
	end

	local page = mw.title.new( basePageName .. queueID, 4 )
	local template = 'GlobalRenameQueueNotes' .. ( page.id > 0 and '' or '-createlink' )

	return frame:preprocess( string.format( '{{%s|{{ns:4}}:%s%s}}', template, basePageName, queueID ) )
end

return p