<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3APortal_bar</id>
	<title>Module:Portal bar - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3APortal_bar"/>
	<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;action=history"/>
	<updated>2026-05-27T20:41:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=40063&amp;oldid=prev</id>
		<title>imported&gt;Hike395: use semantically-meaningful HTML tags</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=40063&amp;oldid=prev"/>
		<updated>2022-12-28T15:09:16Z</updated>

		<summary type="html">&lt;p&gt;use semantically-meaningful HTML tags&lt;/p&gt;
&lt;a href=&quot;https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;amp;diff=40063&amp;amp;oldid=20908&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>imported&gt;Hike395</name></author>
	</entry>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=20908&amp;oldid=prev</id>
		<title>Richardpruen: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=20908&amp;oldid=prev"/>
		<updated>2022-01-01T18:53:45Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&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;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:53, 1 January 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key uk_vapewiki:diff:1.41:old-20907:rev-20908 --&gt;
&lt;/table&gt;</summary>
		<author><name>Richardpruen</name></author>
	</entry>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=20907&amp;oldid=prev</id>
		<title>Wikipedia&gt;Hike395: factor duplicate code out into Module:Portal</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=20907&amp;oldid=prev"/>
		<updated>2021-12-22T23:27:17Z</updated>

		<summary type="html">&lt;p&gt;factor duplicate code out into &lt;a href=&quot;/mediawiki/index.php/Module:Portal&quot; title=&quot;Module:Portal&quot;&gt;Module:Portal&lt;/a&gt;&lt;/p&gt;
&lt;a href=&quot;https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;amp;diff=20907&amp;amp;oldid=19690&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Wikipedia&gt;Hike395</name></author>
	</entry>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=19690&amp;oldid=prev</id>
		<title>Richardpruen: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=19690&amp;oldid=prev"/>
		<updated>2021-12-05T15:26:30Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&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;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:26, 5 December 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key uk_vapewiki:diff:1.41:old-19689:rev-19690 --&gt;
&lt;/table&gt;</summary>
		<author><name>Richardpruen</name></author>
	</entry>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=19689&amp;oldid=prev</id>
		<title>Wikipedia&gt;Izno: tstyles, some style cleaning, some TODOs</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Portal_bar&amp;diff=19689&amp;oldid=prev"/>
		<updated>2021-11-14T22:51:10Z</updated>

		<summary type="html">&lt;p&gt;tstyles, some style cleaning, some TODOs&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{portal bar}}.&lt;br /&gt;
&lt;br /&gt;
require(&amp;#039;Module:No globals&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local getImageName = require( &amp;#039;Module:Portal&amp;#039; ).image&lt;br /&gt;
local yesno = require( &amp;#039;Module:Yesno&amp;#039; )&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function checkPortalExists(portal)&lt;br /&gt;
	return not (mw.title.makeTitle(100, portal).id == 0)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Check whether to do tracking in this namespace&lt;br /&gt;
-- Returns true unless the page is one of the banned namespaces&lt;br /&gt;
local function isTrackedNamespace()&lt;br /&gt;
	local thisPageNS = mw.title.getCurrentTitle().namespace&lt;br /&gt;
	return thisPageNS ~= 1 -- Talk&lt;br /&gt;
		and thisPageNS ~= 2 -- User&lt;br /&gt;
		and thisPageNS ~= 3 -- User talk&lt;br /&gt;
		and thisPageNS ~= 5 -- Wikipedia talk&lt;br /&gt;
		and thisPageNS ~= 7 -- File talk&lt;br /&gt;
		and thisPageNS ~= 11 -- Template talk&lt;br /&gt;
		and thisPageNS ~= 15 -- Category talk&lt;br /&gt;
		and thisPageNS ~= 101 -- Portal talk&lt;br /&gt;
		and thisPageNS ~= 118 -- Draft&lt;br /&gt;
		and thisPageNS ~= 119 -- Draft talk&lt;br /&gt;
		and thisPageNS ~= 829 -- Module talk&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Check whether to do tracking on this pagename&lt;br /&gt;
-- Returns false if the page title matches one of the banned strings&lt;br /&gt;
-- Otherwise returns true&lt;br /&gt;
local function isTrackedPagename()&lt;br /&gt;
	local thisPageLC = mw.ustring.lower(mw.title.getCurrentTitle().text)&lt;br /&gt;
	local match = string.match&lt;br /&gt;
	return match(thisPageLC, &amp;quot;/archive&amp;quot;) == nil&lt;br /&gt;
		and match(thisPageLC, &amp;quot;/doc&amp;quot;) == nil&lt;br /&gt;
		and match(thisPageLC, &amp;quot;/test&amp;quot;) == nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Builds the portal bar used by {{portal bar}}.&lt;br /&gt;
function p._main( portals, args )&lt;br /&gt;
	&lt;br /&gt;
	-- Don&amp;#039;t display a blank navbox if no portals were specified.&lt;br /&gt;
	if #portals &amp;lt; 1 then return &amp;#039;&amp;#039; end&lt;br /&gt;
	&lt;br /&gt;
	local nav = mw.html.create( &amp;#039;ul&amp;#039; )&lt;br /&gt;
		:addClass( &amp;#039;portal-bar noprint metadata&amp;#039; )&lt;br /&gt;
		:attr( &amp;#039;role&amp;#039;, &amp;#039;navigation&amp;#039; )&lt;br /&gt;
		:attr( &amp;#039;aria-label&amp;#039; , &amp;#039;Portals&amp;#039; )&lt;br /&gt;
	if yesno( args.border ) == false then&lt;br /&gt;
		nav&lt;br /&gt;
			:addClass(&amp;#039;portal-bar-unbordered&amp;#039;)&lt;br /&gt;
	else&lt;br /&gt;
		nav&lt;br /&gt;
			:addClass( &amp;#039;portal-bar-bordered&amp;#039; )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local trackingEnabled = true&lt;br /&gt;
	local tracking = args.tracking&lt;br /&gt;
	if (tracking == &amp;#039;no&amp;#039; or tracking == &amp;#039;n&amp;#039; or tracking == &amp;#039;false&amp;#039;) or&lt;br /&gt;
		not isTrackedNamespace() or not isTrackedPagename() then&lt;br /&gt;
		trackingEnabled = false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- TODO: This used to say &amp;#039;if no portals are specified&amp;#039;, but we return early&lt;br /&gt;
	-- above. Someone should check whether this is really &amp;#039;portals[1]&amp;#039; or #portals &amp;lt; 0.&lt;br /&gt;
	-- I don&amp;#039;t believe the block in the conditional is reachable currently&lt;br /&gt;
	-- because if it were we would probably get a Lua script error because&lt;br /&gt;
	-- warning was previously undefined&lt;br /&gt;
	&lt;br /&gt;
	-- If the first portal is not specified,&lt;br /&gt;
	-- display an error and add the page to a tracking category.&lt;br /&gt;
	if not portals[1] then&lt;br /&gt;
		local nominimum = args.nominimum&lt;br /&gt;
		local warning = mw.html.create()&lt;br /&gt;
		if nominimum ~= &amp;#039;yes&amp;#039; and nominimum ~= &amp;#039;y&amp;#039; and nominimum ~= &amp;#039;true&amp;#039; then&lt;br /&gt;
			warning:tag(&amp;#039;strong&amp;#039;)&lt;br /&gt;
				:addClass(&amp;#039;error&amp;#039;)&lt;br /&gt;
				:wikitext(&amp;#039;No portals specified: please specify at least one portal&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		if trackingEnabled then&lt;br /&gt;
			warning:wikitext(&amp;#039;[[Category:Portal templates without a parameter]]&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		return tostring(warning)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- scan for nonexistent portals, if they exist remove them from the portals&lt;br /&gt;
	-- table. If redlinks=yes, then don&amp;#039;t remove&lt;br /&gt;
	local portallen = #portals&lt;br /&gt;
	-- traverse the list backwards to ensure that no portals are missed&lt;br /&gt;
	-- (table.remove also moves down the portals in the list, so that the next&lt;br /&gt;
	-- portal isn&amp;#039;t checked if going fowards. going backwards allows us to&lt;br /&gt;
	-- circumvent this issue&lt;br /&gt;
	for i=portallen,1,-1 do&lt;br /&gt;
		-- the use of pcall here catches any errors that may occour when&lt;br /&gt;
		-- attempting to locate pages when the page name is invalid. if pcall&lt;br /&gt;
		-- returns true, then rerun the function to find if the page exists&lt;br /&gt;
		if not pcall(checkPortalExists, portals[i]) or not checkPortalExists(portals[i]) then&lt;br /&gt;
			-- Getting here means a redlinked portal has been found&lt;br /&gt;
			local redlinks = args.redlinks&lt;br /&gt;
			if redlinks == &amp;#039;yes&amp;#039; or redlinks == &amp;#039;y&amp;#039; or redlinks == &amp;#039;true&amp;#039; or redlinks == &amp;#039;include&amp;#039; then&lt;br /&gt;
				-- if redlinks as been set to yes (or similar), add the cleanup&lt;br /&gt;
				-- category and then break the loop before the portal is removed&lt;br /&gt;
				-- from the list&lt;br /&gt;
				if trackingEnabled then&lt;br /&gt;
					nav:wikitext(&amp;#039;[[Category:Portal templates with redlinked portals]]&amp;#039;)&lt;br /&gt;
				end&lt;br /&gt;
				-- TODO: This looks buggy given the comment above; we will always&lt;br /&gt;
				-- break if redlinks are yes, whether or not tracking is enabled&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
			-- remove the portal (this does not happen if redlinks=yes)&lt;br /&gt;
			table.remove(portals,i)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- if the length of the table is different, then rows were removed from the&lt;br /&gt;
	-- table, so portals were removed. If this is the case add the cleanup category&lt;br /&gt;
	if portallen ~= #portals then&lt;br /&gt;
		if #portals == 0 then&lt;br /&gt;
        	if trackingEnabled then&lt;br /&gt;
				return &amp;#039;[[Category:Portal templates with all redlinked portals]]&amp;#039;&lt;br /&gt;
			else&lt;br /&gt;
				return &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
        end&lt;br /&gt;
		if trackingEnabled then&lt;br /&gt;
			nav:wikitext(&amp;#039;[[Category:Portal templates with redlinked portals]]&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for _, portal in ipairs( portals ) do&lt;br /&gt;
		nav&lt;br /&gt;
			:tag( &amp;#039;li&amp;#039; )&lt;br /&gt;
				:tag( &amp;#039;span&amp;#039; )&lt;br /&gt;
					:wikitext( string.format(&lt;br /&gt;
						&amp;#039;[[File:%s|24x21px|alt=]]&amp;#039;, getImageName{ portal }&lt;br /&gt;
					) )&lt;br /&gt;
					:done()&lt;br /&gt;
				:wikitext( string.format(&lt;br /&gt;
					&amp;#039;[[Portal:%s|%s portal]]&amp;#039;, portal, portal&lt;br /&gt;
				) )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return mw.getCurrentFrame():extensionTag{&lt;br /&gt;
		name = &amp;#039;templatestyles&amp;#039;, args = { src = &amp;#039;Module:Portal bar/styles.css&amp;#039; }&lt;br /&gt;
	} .. tostring( nav )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Processes external arguments and sends them to the other functions.&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
	-- If called via #invoke, use the args passed into the invoking template, or&lt;br /&gt;
	-- the args passed to #invoke if any exist. Otherwise assume args are being&lt;br /&gt;
	-- passed directly in from the debug console or from another Lua module.&lt;br /&gt;
	local origArgs&lt;br /&gt;
	if type( frame.getParent ) == &amp;#039;function&amp;#039; then&lt;br /&gt;
		origArgs = frame:getParent().args&lt;br /&gt;
		for k, v in pairs( frame.args ) do&lt;br /&gt;
			origArgs = frame.args&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		origArgs = frame&lt;br /&gt;
	end&lt;br /&gt;
	-- Process the args to make an array of portal names that can be used with&lt;br /&gt;
	-- ipairs. We need to use ipairs because we want to list all the portals in&lt;br /&gt;
	-- the order they were passed to the template, but we also want to be able&lt;br /&gt;
	-- to deal with positional arguments passed explicitly, for example&lt;br /&gt;
	-- {{portal|2=Politics}}. The behaviour of ipairs is undefined if nil values&lt;br /&gt;
	-- are present, so we need to make sure they are all removed.&lt;br /&gt;
	local portals, args = {}, {}&lt;br /&gt;
	for k, v in pairs( origArgs ) do&lt;br /&gt;
		-- Make sure we have no non-string portal names.&lt;br /&gt;
		if type( k ) == &amp;#039;number&amp;#039; and type( v ) == &amp;#039;string&amp;#039; then&lt;br /&gt;
			if mw.ustring.find( v, &amp;#039;%S&amp;#039; ) then -- Remove blank values.&lt;br /&gt;
				table.insert( portals, k )&lt;br /&gt;
				end&lt;br /&gt;
			elseif type( k ) ~= &amp;#039;number&amp;#039; then -- Separate named arguments from portals.&lt;br /&gt;
			if type( v ) == &amp;#039;string&amp;#039; then&lt;br /&gt;
				v = mw.text.trim( v )&lt;br /&gt;
			end&lt;br /&gt;
			args[ k ] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort( portals )&lt;br /&gt;
	for i, v in ipairs( portals ) do&lt;br /&gt;
		-- Swap keys with values, trimming whitespace.&lt;br /&gt;
		portals[ i ] = mw.text.trim( origArgs[ v ] )&lt;br /&gt;
	end&lt;br /&gt;
	return p._main( portals, args )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Izno</name></author>
	</entry>
</feed>