<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="nb">
	<id>https://www.wikisida.no/index.php?action=history&amp;feed=atom&amp;title=Modul%3ARedirect_hatnote</id>
	<title>Modul:Redirect hatnote - Sideversjonshistorikk</title>
	<link rel="self" type="application/atom+xml" href="https://www.wikisida.no/index.php?action=history&amp;feed=atom&amp;title=Modul%3ARedirect_hatnote"/>
	<link rel="alternate" type="text/html" href="https://www.wikisida.no/index.php?title=Modul:Redirect_hatnote&amp;action=history"/>
	<updated>2026-04-04T11:43:19Z</updated>
	<subtitle>Versjonshistorikk for denne siden på wikien</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://www.wikisida.no/index.php?title=Modul:Redirect_hatnote&amp;diff=18905&amp;oldid=prev</id>
		<title>Wikisida: Én sideversjon ble importert</title>
		<link rel="alternate" type="text/html" href="https://www.wikisida.no/index.php?title=Modul:Redirect_hatnote&amp;diff=18905&amp;oldid=prev"/>
		<updated>2026-02-11T09:49:43Z</updated>

		<summary type="html">&lt;p&gt;Én sideversjon ble importert&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;nb&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Eldre sideversjon&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Sideversjonen fra 11. feb. 2026 kl. 09:49&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;nb&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Ingen forskjell)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key c1wiki:diff:1.41:old-18904:rev-18905 --&gt;
&lt;/table&gt;</summary>
		<author><name>Wikisida</name></author>
	</entry>
	<entry>
		<id>https://www.wikisida.no/index.php?title=Modul:Redirect_hatnote&amp;diff=18904&amp;oldid=prev</id>
		<title>nb&gt;Tholme: norsk</title>
		<link rel="alternate" type="text/html" href="https://www.wikisida.no/index.php?title=Modul:Redirect_hatnote&amp;diff=18904&amp;oldid=prev"/>
		<updated>2022-10-03T21:46:14Z</updated>

		<summary type="html">&lt;p&gt;norsk&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ny side&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;#039;&amp;quot;X&amp;quot; redirects here. For other uses, see Y.&amp;#039;&lt;br /&gt;
-- It implements the {{redirect}} template.&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require(&amp;#039;Module:Hatnote&amp;#039;)&lt;br /&gt;
local mHatList = require(&amp;#039;Module:Hatnote list&amp;#039;)&lt;br /&gt;
local mArguments --lazily initialize&lt;br /&gt;
local libraryUtil = require(&amp;#039;libraryUtil&amp;#039;)&lt;br /&gt;
local checkType = libraryUtil.checkType&lt;br /&gt;
local checkTypeMulti = libraryUtil.checkTypeMulti&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Helper functions&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local function getTitle(...)&lt;br /&gt;
	--Calls mw.title.new and returns either a title object, or nil on error&lt;br /&gt;
	local success, titleObj = pcall(mw.title.new, ...)&lt;br /&gt;
	return success and titleObj or nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Main functions&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
function p.redirect(frame)&lt;br /&gt;
	mArguments = require(&amp;#039;Module:Arguments&amp;#039;)&lt;br /&gt;
	local args = mArguments.getArgs(frame, {parentOnly=true})&lt;br /&gt;
	--Get number of redirects&lt;br /&gt;
	local numRedirects = tonumber(frame.args[1]) or 1&lt;br /&gt;
	-- Create the options table.&lt;br /&gt;
	local options = {}&lt;br /&gt;
	options.selfref = args.selfref&lt;br /&gt;
	return p._redirect(args, numRedirects, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._redirect(args, numRedirects, options, currentTitle, redirectTitle, targetTitle)&lt;br /&gt;
	-- Validate the input. Don&amp;#039;t bother checking currentTitle, redirectTitle or&lt;br /&gt;
	-- targetTitle, as they are only used in testing.&lt;br /&gt;
	checkType(&amp;#039;_redirect&amp;#039;, 1, args, &amp;#039;table&amp;#039;)&lt;br /&gt;
	checkType(&amp;#039;_redirect&amp;#039;, 2, numRedirects, &amp;#039;number&amp;#039;, true)&lt;br /&gt;
	numRedirects = numRedirects or 1&lt;br /&gt;
	checkType(&amp;#039;_redirect&amp;#039;, 3, options, &amp;#039;table&amp;#039;, true)&lt;br /&gt;
	options = options or {}&lt;br /&gt;
	currentTitle = currentTitle or mw.title.getCurrentTitle()&lt;br /&gt;
	-- Get the table of redirects&lt;br /&gt;
	local redirect = {}&lt;br /&gt;
	for i = 1, numRedirects do&lt;br /&gt;
		-- Return an error if a redirect parameter is missing.&lt;br /&gt;
		if not args[i] then&lt;br /&gt;
			return mHatnote.makeWikitextError(&lt;br /&gt;
				&amp;#039;missing redirect parameter&amp;#039;,&lt;br /&gt;
				&amp;#039;Template:Redirect#Errors&amp;#039;,&lt;br /&gt;
				args.category&lt;br /&gt;
			)&lt;br /&gt;
		end&lt;br /&gt;
		redirect[i] = args[i]&lt;br /&gt;
	end&lt;br /&gt;
	-- Generate the text.&lt;br /&gt;
	local formattedRedirect = {}&lt;br /&gt;
	for k,v in pairs(redirect) do&lt;br /&gt;
		formattedRedirect[k] = mHatnote.quote(v)&lt;br /&gt;
	end&lt;br /&gt;
	local text = {&lt;br /&gt;
		mHatList.andList(formattedRedirect) .. &amp;#039; omdirigeres hit.&amp;#039;,&lt;br /&gt;
		mHatList._forSee(args, #redirect + 1, {title = redirect[1], extratext = args.text})&lt;br /&gt;
	}&lt;br /&gt;
	text = table.concat(text, &amp;#039; &amp;#039;)&lt;br /&gt;
	-- Functionality for adding categories	&lt;br /&gt;
	local categoryTable = {}&lt;br /&gt;
	local function addCategory(cat)&lt;br /&gt;
		if cat and cat ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			-- Add by index to avoid duplicates&lt;br /&gt;
			categoryTable[string.format(&amp;#039;[[Category:%s]]&amp;#039;, cat)] = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	--Generate tracking categories&lt;br /&gt;
	local mhOptions = {}&lt;br /&gt;
	local redirTitle&lt;br /&gt;
	for k,v in pairs(redirect) do&lt;br /&gt;
		-- We don&amp;#039;t need a tracking category if the template invocation has been&lt;br /&gt;
		-- copied directly from the docs, or if we aren&amp;#039;t in main- or category-space.&lt;br /&gt;
		if not v:find(&amp;#039;^REDIRECT%d*$&amp;#039;) and v ~= &amp;#039;TERM&amp;#039; -- &lt;br /&gt;
			and currentTitle.namespace == 0 or currentTitle.namespace == 14&lt;br /&gt;
		then&lt;br /&gt;
			redirTitle = redirectTitle or getTitle(v)&lt;br /&gt;
			if not redirTitle or not redirTitle.exists then&lt;br /&gt;
				addCategory(&amp;#039;Missing redirects&amp;#039;)&lt;br /&gt;
			elseif not redirTitle.isRedirect then&lt;br /&gt;
				if string.find(redirTitle:getContent(), &amp;#039;#invoke:RfD&amp;#039;) then&lt;br /&gt;
					addCategory(&amp;#039;Articles with redirect hatnotes impacted by RfD&amp;#039;)&lt;br /&gt;
				else&lt;br /&gt;
					addCategory(&amp;#039;Articles with redirect hatnotes needing review&amp;#039;)&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				local target = targetTitle or redirTitle.redirectTarget&lt;br /&gt;
				if target and target ~= currentTitle then&lt;br /&gt;
					addCategory(&amp;#039;Articles with redirect hatnotes needing review&amp;#039;)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Generate the options to pass to [[Module:Hatnote]].&lt;br /&gt;
		if currentTitle.namespace == 0 and not mhOptions.selfref&lt;br /&gt;
			and redirTitle and redirTitle.namespace ~= 0&lt;br /&gt;
		then&lt;br /&gt;
			-- We are on a mainspace page, and the hatnote starts with something&lt;br /&gt;
			-- like &amp;quot;Wikipedia:Foo redirects here&amp;quot;, so automatically label it as&lt;br /&gt;
			-- a self-reference.&lt;br /&gt;
			mhOptions.selfref = true&lt;br /&gt;
		else&lt;br /&gt;
			mhOptions.selfref = options.selfref&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	--concatenate all the categories&lt;br /&gt;
	local category = &amp;#039;&amp;#039;&lt;br /&gt;
	for k,v in pairs(categoryTable) do&lt;br /&gt;
		category = category .. k&lt;br /&gt;
	end&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>nb&gt;Tholme</name></author>
	</entry>
</feed>