Module:Section link: Difference between revisions
Content deleted Content added
Caleb Cooper (talk | contribs) m 1 revision imported |
Caleb Cooper (talk | contribs) No edit summary |
||
Line 1:
-- This module implements {{section link}}.
require('Module:No globals');▼
local checkType = require('libraryUtil').checkType
local p = {}
Line 9:
display = display or section
page = page or ''
return string.format('[[%s#%s|%s]]', page, section, display)
end
Line 48 ⟶ 37:
-- Make the link(s).
local isShowingPage = not yesno(options.nopage)
if #sections <= 1 then
local linkPage = page or ''
local section = sections[1] or 'Notes'
local display = '§&
if isShowingPage then
page = page or title.prefixedText
end
return makeSectionLink(linkPage, section, display)
Line 90 ⟶ 67:
-- Add the intro text.
local intro = '§§&
if isShowingPage then
intro = (page or title.prefixedText) .. ' ' .. intro
Line 101 ⟶ 78:
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Section link',
Line 112 ⟶ 88:
end
})
-- Sort the arguments.
Line 130 ⟶ 96:
-- Doing this in the loop because of a bug in [[Module:Arguments]]
-- when using pairs with deleted arguments.
page =
elseif type(k) == 'number' then
sections[k] = v
Line 136 ⟶ 102:
options[k] = v
end
end
| |||