<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AContext-link</id>
	<title>Module:Context-link - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AContext-link"/>
	<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:Context-link&amp;action=history"/>
	<updated>2026-04-07T17:56:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://mbwiki.stairwaygames.work/w/index.php?title=Module:Context-link&amp;diff=5686&amp;oldid=prev</id>
		<title>Admin coral island: Created page with &quot;-- &lt;nowiki&gt; -- This module implements context-link templates. local p = {} local getArgs = require(&#039;Dev:Arguments&#039;).getArgs  -- Helper functions  local function findNamespace(link)     local namespace = link:match(&#039;^(.-):&#039;)      if namespace then         local namespaces = mw.site.namespaces[namespace]         if namespaces then             return namespaces.id         end     end      return 0 end   local function formatLink(link, display)     local namespace = findName...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:Context-link&amp;diff=5686&amp;oldid=prev"/>
		<updated>2023-08-04T02:26:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- &amp;lt;nowiki&amp;gt; -- This module implements context-link templates. local p = {} local getArgs = require(&amp;#039;Dev:Arguments&amp;#039;).getArgs  -- Helper functions  local function findNamespace(link)     local namespace = link:match(&amp;#039;^(.-):&amp;#039;)      if namespace then         local namespaces = mw.site.namespaces[namespace]         if namespaces then             return namespaces.id         end     end      return 0 end   local function formatLink(link, display)     local namespace = findName...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- This module implements context-link templates.&lt;br /&gt;
local p = {}&lt;br /&gt;
local getArgs = require(&amp;#039;Dev:Arguments&amp;#039;).getArgs&lt;br /&gt;
&lt;br /&gt;
-- Helper functions&lt;br /&gt;
&lt;br /&gt;
local function findNamespace(link)&lt;br /&gt;
    local namespace = link:match(&amp;#039;^(.-):&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
    if namespace then&lt;br /&gt;
        local namespaces = mw.site.namespaces[namespace]&lt;br /&gt;
        if namespaces then&lt;br /&gt;
            return namespaces.id&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return 0&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
local function formatLink(link, display)&lt;br /&gt;
    local namespace = findNamespace(link, false)&lt;br /&gt;
    local colon&lt;br /&gt;
&lt;br /&gt;
    if namespace == 6 or namespace == 14 then&lt;br /&gt;
        colon = &amp;#039;:&amp;#039;&lt;br /&gt;
    else&lt;br /&gt;
        colon = &amp;#039;&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    -- Find the display value.&lt;br /&gt;
    if not display then&lt;br /&gt;
        local page, section = link:match(&amp;#039;^(.-)#(.*)$&amp;#039;)&lt;br /&gt;
        if page then&lt;br /&gt;
            display = page .. &amp;#039; § &amp;#039; .. section&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    -- Assemble the link.&lt;br /&gt;
    if display then&lt;br /&gt;
        return string.format(&amp;#039;[[%s%s|%s]]&amp;#039;, colon, link, display)&lt;br /&gt;
    else&lt;br /&gt;
        return string.format(&amp;#039;[[%s%s]]&amp;#039;, colon, link)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function build(desc, links, options)&lt;br /&gt;
    local linktext&lt;br /&gt;
    &lt;br /&gt;
    if next(links) == nil then&lt;br /&gt;
        linktext = &amp;#039;...&amp;#039;&lt;br /&gt;
    else&lt;br /&gt;
        linktext = table.concat(links, &amp;#039;, &amp;#039;, 1, #links - 1)&lt;br /&gt;
    &lt;br /&gt;
        if #links &amp;gt; 1 then&lt;br /&gt;
            linktext = linktext .. &amp;#039;, or &amp;#039;&lt;br /&gt;
        end&lt;br /&gt;
        linktext = linktext .. links[#links]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local container = mw.html.create(&amp;#039;div&amp;#039;)&lt;br /&gt;
        :addClass(&amp;#039;context-link&amp;#039;)&lt;br /&gt;
        :addClass(options.extraclasses)&lt;br /&gt;
        :cssText(options.extrastyles)&lt;br /&gt;
        :wikitext(desc .. &amp;#039; &amp;#039; .. linktext)&lt;br /&gt;
&lt;br /&gt;
    return tostring(container)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Produces standard context-link text.&lt;br /&gt;
function p.contextlink(frame)&lt;br /&gt;
    local args = getArgs(frame)&lt;br /&gt;
    local desc = args.desc or &amp;#039;For another page, see&amp;#039;&lt;br /&gt;
    local links = {}&lt;br /&gt;
    for i, link in ipairs(args) do&lt;br /&gt;
        local display = args[&amp;#039;t&amp;#039; .. i]&lt;br /&gt;
        table.insert(links, formatLink(link, display))&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local options = {}&lt;br /&gt;
    options.extraclasses = args.class&lt;br /&gt;
    options.extrastyles = args.style&lt;br /&gt;
    return build(desc, links, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;br /&gt;
-- &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin coral island</name></author>
	</entry>
</feed>