<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>http://atlasnacional.ign.es/index.php?action=history&amp;feed=atom&amp;title=M%C3%B3dulo%3ASection_link</id>
	<title>Módulo:Section link - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="http://atlasnacional.ign.es/index.php?action=history&amp;feed=atom&amp;title=M%C3%B3dulo%3ASection_link"/>
	<link rel="alternate" type="text/html" href="http://atlasnacional.ign.es/index.php?title=M%C3%B3dulo:Section_link&amp;action=history"/>
	<updated>2026-04-06T02:00:34Z</updated>
	<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>http://atlasnacional.ign.es/index.php?title=M%C3%B3dulo:Section_link&amp;diff=3130&amp;oldid=prev</id>
		<title>Ane: 1 revisión importada</title>
		<link rel="alternate" type="text/html" href="http://atlasnacional.ign.es/index.php?title=M%C3%B3dulo:Section_link&amp;diff=3130&amp;oldid=prev"/>
		<updated>2018-11-16T07:59:04Z</updated>

		<summary type="html">&lt;p&gt;1 revisión importada&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{section link}}.&lt;br /&gt;
&lt;br /&gt;
local checkType = require('libraryUtil').checkType&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function makeSectionLink(page, section, display)&lt;br /&gt;
	display = display or section&lt;br /&gt;
	page = page or ''&lt;br /&gt;
	return string.format('[[%s#%s|%s]]', page, section, display)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function normalizeTitle(title)&lt;br /&gt;
	title = mw.ustring.gsub(mw.ustring.gsub(title,&amp;quot;'&amp;quot;,&amp;quot;&amp;quot;),'&amp;quot;','')&lt;br /&gt;
	return mw.title.new(mw.ustring.gsub(title,&amp;quot;%b&amp;lt;&amp;gt;&amp;quot;,&amp;quot;&amp;quot;)).prefixedText&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(page, sections, options, title)&lt;br /&gt;
	-- Validate input.&lt;br /&gt;
	checkType('_main', 1, page, 'string', true)&lt;br /&gt;
	checkType('_main', 3, options, 'table', true)&lt;br /&gt;
	if sections == nil then&lt;br /&gt;
		sections = {}&lt;br /&gt;
	elseif type(sections) == 'string' then&lt;br /&gt;
		sections = {sections}&lt;br /&gt;
	elseif type(sections) ~= 'table' then&lt;br /&gt;
		error(string.format(&lt;br /&gt;
			&amp;quot;type error in argument #2 to '_main' &amp;quot; ..&lt;br /&gt;
			&amp;quot;(string, table or nil expected, got %s)&amp;quot;,&lt;br /&gt;
			type(sections)&lt;br /&gt;
		), 2)&lt;br /&gt;
	end&lt;br /&gt;
	options = options or {}&lt;br /&gt;
	title = title or mw.title.getCurrentTitle()&lt;br /&gt;
&lt;br /&gt;
	-- Deal with blank page names elegantly&lt;br /&gt;
	if page and not page:find('%S') then&lt;br /&gt;
		page = nil&lt;br /&gt;
		options.nopage = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Make the link(s).&lt;br /&gt;
	local isShowingPage = not options.nopage&lt;br /&gt;
	if #sections &amp;lt;= 1 then&lt;br /&gt;
		local linkPage = page or ''&lt;br /&gt;
		local section = sections[1] or 'Notes'&lt;br /&gt;
		local display = '§&amp;amp;nbsp;' .. section&lt;br /&gt;
		if isShowingPage then&lt;br /&gt;
			page = page or title.prefixedText&lt;br /&gt;
			if options.display and options.display ~= '' then&lt;br /&gt;
				if normalizeTitle(options.display) == normalizeTitle(page) then&lt;br /&gt;
					display = options.display .. ' ' .. display&lt;br /&gt;
				else&lt;br /&gt;
					error(string.format(&lt;br /&gt;
						'Display title &amp;quot;%s&amp;quot; was ignored since it is ' ..&lt;br /&gt;
						&amp;quot;not equivalent to the page's actual title&amp;quot;,&lt;br /&gt;
						options.display&lt;br /&gt;
					), 0)&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				display = page .. ' ' .. display&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return makeSectionLink(linkPage, section, display)&lt;br /&gt;
	else&lt;br /&gt;
		-- Multiple sections. First, make a list of the links to display.&lt;br /&gt;
		local ret = {}&lt;br /&gt;
		for i, section in ipairs(sections) do&lt;br /&gt;
			ret[i] = makeSectionLink(page, section)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Assemble the list of links into a string with mw.text.listToText.&lt;br /&gt;
		-- We use the default separator for mw.text.listToText, but a custom&lt;br /&gt;
		-- conjunction. There is also a special case conjunction if we only&lt;br /&gt;
		-- have two links.&lt;br /&gt;
		local conjunction&lt;br /&gt;
		if #sections == 2 then&lt;br /&gt;
			conjunction = '&amp;amp;#8203; and '&lt;br /&gt;
		else&lt;br /&gt;
			conjunction = ', and '&lt;br /&gt;
		end&lt;br /&gt;
		ret = mw.text.listToText(ret, nil, conjunction)&lt;br /&gt;
&lt;br /&gt;
		-- Add the intro text.&lt;br /&gt;
		local intro = '§§&amp;amp;nbsp;'&lt;br /&gt;
		if isShowingPage then&lt;br /&gt;
			intro = (page or title.prefixedText) .. ' ' .. intro&lt;br /&gt;
		end&lt;br /&gt;
		ret = intro .. ret&lt;br /&gt;
&lt;br /&gt;
		return ret&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = require('Module:Arguments').getArgs(frame, {&lt;br /&gt;
		wrappers = 'Template:Section link',&lt;br /&gt;
		valueFunc = function (key, value)&lt;br /&gt;
			value = value:match('^%s*(.-)%s*$') -- Trim whitespace&lt;br /&gt;
			-- Allow blank first parameters, as the wikitext template does this.&lt;br /&gt;
			if value ~= '' or key == 1 then&lt;br /&gt;
				return value&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	})&lt;br /&gt;
&lt;br /&gt;
	-- Sort the arguments.&lt;br /&gt;
	local page&lt;br /&gt;
	local sections, options = {}, {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if k == 1 then&lt;br /&gt;
			-- Doing this in the loop because of a bug in [[Module:Arguments]]&lt;br /&gt;
			-- when using pairs with deleted arguments.&lt;br /&gt;
			page = mw.text.decode(v, decodeNamedEntities)&lt;br /&gt;
		elseif type(k) == 'number' then&lt;br /&gt;
			sections[k] = v&lt;br /&gt;
		else&lt;br /&gt;
			options[k] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Extract section from page, if present&lt;br /&gt;
	if page then&lt;br /&gt;
		local p, s = page:match('^(.-)#(.*)$')&lt;br /&gt;
		if p then page, sections[1] = p, s end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Compress the sections array.&lt;br /&gt;
	local function compressArray(t)&lt;br /&gt;
		local nums, ret = {}, {}&lt;br /&gt;
		for num in pairs(t) do&lt;br /&gt;
			nums[#nums + 1] = num&lt;br /&gt;
		end&lt;br /&gt;
		table.sort(nums)&lt;br /&gt;
		for i, num in ipairs(nums) do&lt;br /&gt;
			ret[i] = t[num]&lt;br /&gt;
		end&lt;br /&gt;
		return ret&lt;br /&gt;
	end&lt;br /&gt;
	sections = compressArray(sections)&lt;br /&gt;
&lt;br /&gt;
	return p._main(page, sections, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Ane</name></author>
		
	</entry>
</feed>