<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.hackslashmine.net/hsmwiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.hackslashmine.net/hsmwiki/index.php?action=history&amp;feed=atom&amp;title=Module%3APortal</id>
		<title>Module:Portal - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.hackslashmine.net/hsmwiki/index.php?action=history&amp;feed=atom&amp;title=Module%3APortal"/>
		<link rel="alternate" type="text/html" href="http://www.hackslashmine.net/hsmwiki/index.php?title=Module:Portal&amp;action=history"/>
		<updated>2026-07-04T06:36:51Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.2</generator>

	<entry>
		<id>http://www.hackslashmine.net/hsmwiki/index.php?title=Module:Portal&amp;diff=1202&amp;oldid=prev</id>
		<title>Frizzil: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://www.hackslashmine.net/hsmwiki/index.php?title=Module:Portal&amp;diff=1202&amp;oldid=prev"/>
				<updated>2013-06-14T21:01:24Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:01, 14 June 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Frizzil</name></author>	</entry>

	<entry>
		<id>http://www.hackslashmine.net/hsmwiki/index.php?title=Module:Portal&amp;diff=1201&amp;oldid=prev</id>
		<title>Mr. Stradivarius: Protected Module:Portal: Highly visible template or Lua module ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</title>
		<link rel="alternate" type="text/html" href="http://www.hackslashmine.net/hsmwiki/index.php?title=Module:Portal&amp;diff=1201&amp;oldid=prev"/>
				<updated>2013-04-04T13:43:33Z</updated>
		
		<summary type="html">&lt;p&gt;Protected Module:Portal: &lt;a href=&quot;/hsmwiki/index.php?title=WP:High-risk_templates&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:High-risk templates (page does not exist)&quot;&gt;Highly visible template or Lua module&lt;/a&gt; ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{Portal}}&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
 &lt;br /&gt;
local HtmlBuilder = require('Module:HtmlBuilder')&lt;br /&gt;
local HtmlError = require('Module:Error')&lt;br /&gt;
&lt;br /&gt;
-- This function generates the html code.&lt;br /&gt;
local function _portal(args)&lt;br /&gt;
&lt;br /&gt;
    local root = HtmlBuilder.create('div')&lt;br /&gt;
    &lt;br /&gt;
    root&lt;br /&gt;
        .addClass('noprint')&lt;br /&gt;
        .addClass((args.left == 'yes' and 'tleft') or 'tright')&lt;br /&gt;
        .addClass('portal')&lt;br /&gt;
        .css('border', 'solid #aaa 1px')&lt;br /&gt;
        .css('margin', args.margin or (args.left == 'yes' and '0.5em 1em 0.5em 0') or '0.5em 0 0.5em 1em')&lt;br /&gt;
        .newline()&lt;br /&gt;
&lt;br /&gt;
    -- Start the table. This corresponds to the start of the wikitext table&lt;br /&gt;
    -- in the old [[Template:Portal]].&lt;br /&gt;
    local tableroot = root.tag('table')&lt;br /&gt;
        .css('background', '#f9f9f9')&lt;br /&gt;
        .css('font-size', '85%')&lt;br /&gt;
        .css('line-height', '110%')&lt;br /&gt;
        .css('max-width', '175px')&lt;br /&gt;
        .css('width', args.boxsize and (args.boxsize .. 'px'))&lt;br /&gt;
    &lt;br /&gt;
    -- If no portals have been specified, display an error and add the page to a tracking category.&lt;br /&gt;
    if not args[1] then&lt;br /&gt;
        tableroot.wikitext(&lt;br /&gt;
            tostring(HtmlError.error{'No portals specified: please specify at least one portal'})&lt;br /&gt;
            .. '[[Category:Portal templates without a parameter]]'&lt;br /&gt;
        )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Display the portals specified in the positional arguments.&lt;br /&gt;
    for i,v in ipairs(args) do&lt;br /&gt;
        v = mw.ustring.match(v, '^%s*(.*%S)') or ''  -- Trim whitespace.&lt;br /&gt;
        &lt;br /&gt;
        -- Portal image names are stored in subtemplates of [[Template:Portal/Images]].&lt;br /&gt;
        -- The name of the subtemplate is the portal name in all lower case, but with&lt;br /&gt;
        -- the first character in upper case.&lt;br /&gt;
        &lt;br /&gt;
        -- Work out the image subtemplate location.&lt;br /&gt;
        local lang = mw.getContentLanguage()&lt;br /&gt;
        local imagetemplatename = 'Portal/Images/' .. lang:ucfirst(lang:lc(v))&lt;br /&gt;
&lt;br /&gt;
        -- Check the image template name. We need three checks: 1) check with pcall to see if&lt;br /&gt;
        -- we are over the expensive function call limit; 2) check if the proposed image template&lt;br /&gt;
        -- name uses invalid characters (mw.title.new returns nil if this is the case); and 3) &lt;br /&gt;
        -- check if the image subtemplate exists.&lt;br /&gt;
        local goodtitlecall, imagetemplateobject = pcall(mw.title.new, imagetemplatename, 'Template')&lt;br /&gt;
        if not (goodtitlecall and imagetemplateobject and imagetemplateobject.exists) then&lt;br /&gt;
            imagetemplatename = 'Portal/Images/Default'&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        -- Expand the image subtemplate to get the image name&lt;br /&gt;
        local imagename = mw.getCurrentFrame():expandTemplate{ title = imagetemplatename }&lt;br /&gt;
            &lt;br /&gt;
        -- Generate the html for the image and the portal name.&lt;br /&gt;
        tableroot&lt;br /&gt;
            .newline()&lt;br /&gt;
            .tag('tr')&lt;br /&gt;
                .attr('valign', 'middle')&lt;br /&gt;
                .tag('td')&lt;br /&gt;
                    .css('text-align', 'center')&lt;br /&gt;
                    .wikitext('[[File:' .. imagename .. '|32x28px|alt=Portal icon]]')&lt;br /&gt;
                    .done()&lt;br /&gt;
                .tag('td')&lt;br /&gt;
                    .css('padding', '0 0.2em')&lt;br /&gt;
                    .css('vertical-align', 'middle')&lt;br /&gt;
                    .css('font-style', 'italic')&lt;br /&gt;
                    .css('font-weight', 'bold')&lt;br /&gt;
                    .wikitext('[[Portal:' .. v .. '|' .. v .. ((args['break'] == 'yes' and '&amp;lt;br /&amp;gt;') or ' ') .. 'portal]]')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This function gets the arguments passed to the module and passes them&lt;br /&gt;
-- to the _portal() function above.&lt;br /&gt;
function p.portal(frame)&lt;br /&gt;
    local orig_args&lt;br /&gt;
    if frame == mw.getCurrentFrame() then&lt;br /&gt;
        -- We're being called via #invoke. If the invoking template passed any arguments,&lt;br /&gt;
        -- use them. Otherwise, use the arguments that were passed into the template.&lt;br /&gt;
        orig_args = frame:getParent().args&lt;br /&gt;
        for k, v in pairs(frame.args) do&lt;br /&gt;
            orig_args = frame.args&lt;br /&gt;
            break&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        -- We're being called from another module or from the debug console, so assume&lt;br /&gt;
        -- the arguments are passed in directly.&lt;br /&gt;
        orig_args = frame&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- We want to list all the portals in the order they were passed to the template. &lt;br /&gt;
    -- We also want to be able to deal with positional arguments passed explicitly, &lt;br /&gt;
    -- for example {{portal|2=Politics}}. However, pairs() doesn't guarantee the correct &lt;br /&gt;
    -- order, and ipairs() will stop after the first nil value. To get around this, we &lt;br /&gt;
    -- create a new table of arguments where nil values have been removed, so that we &lt;br /&gt;
    -- can traverse the numerical arguments using ipairs(). We also remove values which &lt;br /&gt;
    -- only consist of whitespace. ParserFunctions considers these to be false, and by&lt;br /&gt;
    -- removing them Lua will consider them false too.&lt;br /&gt;
    &lt;br /&gt;
    local args = {} -- Arguments table.&lt;br /&gt;
    local name_args = {} -- Temporary table for named arguments.&lt;br /&gt;
    for k, v in pairs(orig_args) do&lt;br /&gt;
        if mw.ustring.match(v, '%S') then -- Remove values that are only whitespace.&lt;br /&gt;
            if type(k) == 'number' then&lt;br /&gt;
                table.insert(args, k) -- Put positional argument keys into the arguments table so we can sort them.&lt;br /&gt;
            else&lt;br /&gt;
                -- Put named argument values in their own table while we sort the positional arguments,&lt;br /&gt;
                -- so that we don't have to cycle through all the original arguments again.&lt;br /&gt;
                name_args[k] = v &lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    table.sort(args) -- Sort the positional argument keys into numerical order.&lt;br /&gt;
    for i,v in ipairs(args) do&lt;br /&gt;
        args[i] = orig_args[v] -- Replace positional argument keys with their corresponding values.&lt;br /&gt;
    end&lt;br /&gt;
    for k,v in pairs(name_args) do&lt;br /&gt;
        args[k] = v -- Add named arguments to the args table&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return _portal(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Mr. Stradivarius</name></author>	</entry>

	</feed>