<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3ARedirect_hatnote</id>
	<title>Modul:Redirect hatnote - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3ARedirect_hatnote"/>
	<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=Modul:Redirect_hatnote&amp;action=history"/>
	<updated>2026-04-05T20:49:18Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Verzauberte Welten e.V.</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://www.verzauberte-welten.de/index.php?title=Modul:Redirect_hatnote&amp;diff=1073&amp;oldid=prev</id>
		<title>Maintenance script: Schützte „Modul:Redirect hatnote“ ([Bearbeiten=Nur Administratoren erlauben] (unbeschränkt) [Verschieben=Nur Administratoren erlauben] (unbeschränkt))</title>
		<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=Modul:Redirect_hatnote&amp;diff=1073&amp;oldid=prev"/>
		<updated>2015-08-09T08:56:13Z</updated>

		<summary type="html">&lt;p&gt;Schützte „&lt;a href=&quot;/Modul:Redirect_hatnote&quot; title=&quot;Modul:Redirect hatnote&quot;&gt;Modul:Redirect hatnote&lt;/a&gt;“ ([Bearbeiten=Nur Administratoren erlauben] (unbeschränkt) [Verschieben=Nur Administratoren erlauben] (unbeschränkt))&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 9. August 2015, 10:56 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;de&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(kein Unterschied)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>https://www.verzauberte-welten.de/index.php?title=Modul:Redirect_hatnote&amp;diff=453&amp;oldid=prev</id>
		<title>mw&gt;Oetterer: 1 Version</title>
		<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=Modul:Redirect_hatnote&amp;diff=453&amp;oldid=prev"/>
		<updated>2014-09-17T09:56:34Z</updated>

		<summary type="html">&lt;p&gt;1 Version&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
-- This module produces a &amp;quot;redirect&amp;quot; hatnote. It looks like this:&lt;br /&gt;
-- '&amp;quot;X&amp;quot; redirects here. For other uses, see Y.'&lt;br /&gt;
-- It implements the {{redirect}} template.&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require('Module:Hatnote')&lt;br /&gt;
local libraryUtil = require('libraryUtil')&lt;br /&gt;
local checkType = libraryUtil.checkType&lt;br /&gt;
local mRedirect -- lazily initialise [[Module:Redirect]]&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function getTitle(...)&lt;br /&gt;
	local success, titleObj = pcall(mw.title.new, ...)&lt;br /&gt;
	if success then&lt;br /&gt;
		return titleObj&lt;br /&gt;
	else&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.redirect(frame)&lt;br /&gt;
	-- Get the args table and work out the maximum arg key.&lt;br /&gt;
	local origArgs = frame:getParent().args&lt;br /&gt;
	local args = {}&lt;br /&gt;
	local maxArg = 0&lt;br /&gt;
	for k, v in pairs(origArgs) do&lt;br /&gt;
		if type(k) == 'number' and k &amp;gt; maxArg then&lt;br /&gt;
			maxArg = k&lt;br /&gt;
		end&lt;br /&gt;
		v = v:match('^%s*(.-)%s*$') -- Trim whitespace&lt;br /&gt;
		if v ~= '' then&lt;br /&gt;
			args[k] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Return an error if no redirect was specified.&lt;br /&gt;
	local redirect = args[1]&lt;br /&gt;
	if not redirect then&lt;br /&gt;
		return mHatnote.makeWikitextError(&lt;br /&gt;
			'no redirect specified',&lt;br /&gt;
			'Template:Redirect#Errors',&lt;br /&gt;
			args.category&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Create the data table.&lt;br /&gt;
	local data = {}&lt;br /&gt;
	local iArg = 0&lt;br /&gt;
	local iData = 1&lt;br /&gt;
	repeat&lt;br /&gt;
		iArg = iArg + 2&lt;br /&gt;
		local useTable = data[iData] or {}&lt;br /&gt;
		local pages = useTable.pages or {}&lt;br /&gt;
		local use = args[iArg]&lt;br /&gt;
		local page = args[iArg + 1]&lt;br /&gt;
		local nextUse = args[iArg + 2]&lt;br /&gt;
		pages[#pages + 1] = page&lt;br /&gt;
		useTable.pages = pages&lt;br /&gt;
		if use ~= 'and' then&lt;br /&gt;
			useTable.use = use&lt;br /&gt;
		end&lt;br /&gt;
		data[iData] = useTable&lt;br /&gt;
		if nextUse ~= 'and' then&lt;br /&gt;
			iData = iData + 1&lt;br /&gt;
		end&lt;br /&gt;
	until iArg &amp;gt;= maxArg - 1&lt;br /&gt;
&lt;br /&gt;
	-- Create the options table.&lt;br /&gt;
	local options = {}&lt;br /&gt;
	options.selfref = args.selfref&lt;br /&gt;
		&lt;br /&gt;
	return p._redirect(redirect, data, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatUseTable(useTable, isFirst, redirect)&lt;br /&gt;
	-- Formats one use table. Use tables are the tables inside the data array.&lt;br /&gt;
	-- Each one corresponds to one use. (A use might be the word &amp;quot;cats&amp;quot; in the&lt;br /&gt;
	-- phrase &amp;quot;For cats, see [[Felines]]&amp;quot;.)&lt;br /&gt;
	-- Returns a string, or nil if no use was specified.&lt;br /&gt;
	-- The isFirst parameter is used to apply special formatting for the first&lt;br /&gt;
	-- table in the data array. If isFirst is specified, the redirect parameter&lt;br /&gt;
	useTable = useTable or {}&lt;br /&gt;
	local use&lt;br /&gt;
	if isFirst then&lt;br /&gt;
		use = useTable.use or 'other uses'&lt;br /&gt;
	elseif not useTable.use then&lt;br /&gt;
		return nil&lt;br /&gt;
	elseif tonumber(useTable.use) == 1 then&lt;br /&gt;
		use = 'other uses'&lt;br /&gt;
	else&lt;br /&gt;
		use = useTable.use&lt;br /&gt;
	end&lt;br /&gt;
	local pages = useTable.pages or {}&lt;br /&gt;
	if isFirst then&lt;br /&gt;
		redirect = redirect or error(&lt;br /&gt;
			'isFirst was set in formatUseTable, but no redirect was supplied',&lt;br /&gt;
			2&lt;br /&gt;
		)&lt;br /&gt;
		pages[1] = pages[1] or redirect .. ' (disambiguation)'&lt;br /&gt;
	else&lt;br /&gt;
		pages[1] = pages[1] or useTable.use .. ' (disambiguation)'&lt;br /&gt;
	end&lt;br /&gt;
	pages = mHatnote.formatPages(unpack(pages))&lt;br /&gt;
	pages = mw.text.listToText(pages)&lt;br /&gt;
	return string.format(&lt;br /&gt;
		'For %s, see %s.',&lt;br /&gt;
		use,&lt;br /&gt;
		pages&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._redirect(redirect, data, options, titleObj)&lt;br /&gt;
	-- Validate the input. Don't bother checking titleObj as it is only used&lt;br /&gt;
	-- for testing purposes.&lt;br /&gt;
	checkType('_redirect', 1, redirect, 'string')&lt;br /&gt;
	checkType('_redirect', 2, data, 'table', true)&lt;br /&gt;
	checkType('_redirect', 3, options, 'table', true)&lt;br /&gt;
	data = data or {}&lt;br /&gt;
	options = options or {}&lt;br /&gt;
&lt;br /&gt;
	-- Generate the text.&lt;br /&gt;
	local text = {}&lt;br /&gt;
	text[#text + 1] = '&amp;quot;' .. redirect .. '&amp;quot; redirects here.'&lt;br /&gt;
	text[#text + 1] = formatUseTable(data[1] or {}, true, redirect)&lt;br /&gt;
	if data[1] and data[1].use and data[1].use ~= 'other uses' then&lt;br /&gt;
		for i = 2, #data do&lt;br /&gt;
			text[#text + 1] = formatUseTable(data[i] or {}, false)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	text = table.concat(text, ' ')&lt;br /&gt;
	&lt;br /&gt;
	-- Generate the options to pass to [[Module:Hatnote]].&lt;br /&gt;
	local mhOptions = {}&lt;br /&gt;
	mhOptions.selfref = options.selfref&lt;br /&gt;
&lt;br /&gt;
	-- Find whether to add the tracking category.&lt;br /&gt;
	-- We only add the category if both of the following are true:&lt;br /&gt;
	-- a) redirect isn't any of the keywords 'REDIRECT', 'REDIRECT1',&lt;br /&gt;
	-- 'REDIRECT2', ..., or 'TERM'.&lt;br /&gt;
	-- b) we are in the main namespace.&lt;br /&gt;
	-- If these are both true, then we check for existence of the redirect. If&lt;br /&gt;
	-- it doesn't exist, then we add the missing redirect category. If it does&lt;br /&gt;
	-- exist, but the redirect target is not the current page, we add the&lt;br /&gt;
	-- invalid redirect category.&lt;br /&gt;
	local category&lt;br /&gt;
	if not redirect:find('^REDIRECT%d*$') and redirect ~= 'TERM' then&lt;br /&gt;
		titleObj = titleObj or mw.title.getCurrentTitle()&lt;br /&gt;
		if titleObj.namespace == 0 then&lt;br /&gt;
			local redirectTitle = getTitle(redirect)&lt;br /&gt;
			if redirectTitle then&lt;br /&gt;
				if not redirectTitle.exists then&lt;br /&gt;
					category = '[[Category:Missing redirects]]'&lt;br /&gt;
				else&lt;br /&gt;
					mRedirect = require('Module:Redirect')&lt;br /&gt;
					local target = mRedirect.getTarget(redirectTitle)&lt;br /&gt;
					local targetTitle = target and getTitle(target)&lt;br /&gt;
					if targetTitle and not mw.title.equals(targetTitle, titleObj) then&lt;br /&gt;
						category = '[[Category:Invalid redirects]]'&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	category = category or ''&lt;br /&gt;
&lt;br /&gt;
	return mHatnote._hatnote(text, mhOptions) .. category&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>mw&gt;Oetterer</name></author>
	</entry>
</feed>