<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://idugov.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ARedirect_template</id>
	<title>Module:Redirect template - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://idugov.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ARedirect_template"/>
	<link rel="alternate" type="text/html" href="https://idugov.com/w/index.php?title=Module:Redirect_template&amp;action=history"/>
	<updated>2026-04-17T16:59:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://idugov.com/w/index.php?title=Module:Redirect_template&amp;diff=14325&amp;oldid=prev</id>
		<title>Sanctaria: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://idugov.com/w/index.php?title=Module:Redirect_template&amp;diff=14325&amp;oldid=prev"/>
		<updated>2018-06-12T23:53:35Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require('Module:No globals')&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- key is beginning of arg name. value is table with namespace number and link&lt;br /&gt;
-- alternatively, a function taking the namespace number and returning a validity&lt;br /&gt;
-- can be used&lt;br /&gt;
local namespaceCategories = {&lt;br /&gt;
	all = { function() return true end },&lt;br /&gt;
	main = { 0, '[[wp:mainspace|main]]' },&lt;br /&gt;
	help = { 12, '[[wp:help namespace|help]]' },&lt;br /&gt;
	portal = { 100, '[[wp:portal|portal]]' },&lt;br /&gt;
	talk = { function(n) return n &amp;gt; 0 and n%2 == 1 end, '[[Help:Using talk pages|talk]]' },&lt;br /&gt;
	template = { 10, '[[wp:template namespace|template]]' },&lt;br /&gt;
	wikipedia = { 4, '[[wp:project namespace|Wikipedia project]]' },&lt;br /&gt;
	category = { 14, '[[wp:categorization|category]]' },&lt;br /&gt;
	user = { 2, '[[wp:user pages|user]]' },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Don't convert blank category to nil&lt;br /&gt;
local function valueFunc(key, val)&lt;br /&gt;
	if type(val) == 'string' then&lt;br /&gt;
		val = val:match('^%s*(.-)%s*$')&lt;br /&gt;
		if val == '' and key ~= 'category' and key ~= 'embed' then&lt;br /&gt;
			return nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return val&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getPrettyName(args)&lt;br /&gt;
	for k in pairs(namespaceCategories) do&lt;br /&gt;
		if args[k .. ' category'] then&lt;br /&gt;
			return  &amp;quot;'''[[:Category:&amp;quot; .. args[k .. ' category'] .. &amp;quot;|&amp;quot; .. args.name .. &amp;quot;]]''': &amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;quot;'''&amp;quot; .. args.name .. &amp;quot;''': &amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.core(frame, args)&lt;br /&gt;
	if not args then&lt;br /&gt;
		args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Redirect template/core', valueFunc = valueFunc})&lt;br /&gt;
	end&lt;br /&gt;
	local namespace = mw.title.getCurrentTitle().namespace&lt;br /&gt;
	local otherCategory = args['other category'] and (args.category or string.format('[[Category:%s]]', args['other category']))&lt;br /&gt;
	local embedPossible = args.embed == nil or args.embed == 'yes'&lt;br /&gt;
&lt;br /&gt;
	--- XXX: this is a HORRIBLE HACK. kill it with fire as soon as https://bugzilla.wikimedia.org/show_bug.cgi?id=12974 is fixed&lt;br /&gt;
	local beCompatibleWithBug12974 = args.info and (args.info:find('^[:;#*]', 1) == 1 or args.info:find('{|', 1, true) == 1) and '\n' or ' '&lt;br /&gt;
	&lt;br /&gt;
	local retval = string.format('*%sThis is a redirect%s%s.%s%s',&lt;br /&gt;
		embedPossible and args.name and getPrettyName(args) or '',&lt;br /&gt;
		args.from and (' from ' .. args.from) or '',&lt;br /&gt;
		args.to and (' to ' .. args.to) or '',&lt;br /&gt;
		args.info and beCompatibleWithBug12974 or '',&lt;br /&gt;
		args.info or ''&lt;br /&gt;
	)&lt;br /&gt;
	for k,v in pairs(namespaceCategories) do&lt;br /&gt;
		if args[k .. ' category'] then&lt;br /&gt;
			if type(v[1]) == 'function' and v[1](namespace) or v[1] == namespace then&lt;br /&gt;
				retval = retval .. (args.category or string.format('[[Category:%s]]', args[k .. ' category']))&lt;br /&gt;
			elseif args['other category'] then&lt;br /&gt;
				retval = retval .. otherCategory&lt;br /&gt;
			else&lt;br /&gt;
				retval = retval .. frame:expandTemplate{title = 'Incorrect redirect template', args = {v[2]}}&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return retval&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Redirect template', valueFunc = valueFunc})&lt;br /&gt;
	local retval = p.core(frame, args)&lt;br /&gt;
	if mw.title.getCurrentTitle().namespace == 0 then&lt;br /&gt;
		if args.printworthy == 'yes' then&lt;br /&gt;
			return retval .. (args.category or '[[Category:Printworthy redirects]]')&lt;br /&gt;
		elseif args.printworthy == 'no' then&lt;br /&gt;
			return retval .. (args.category or '[[Category:Unprintworthy redirects]]')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return retval&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Sanctaria</name></author>
	</entry>
</feed>