Module:Section link: Difference between revisions

cleanup code
(Detect anchors in page parameter, other code cleanup)
(cleanup code)
Line 16:
end
 
function p._main(page, sections, options, title, displaytitle)
-- Validate input.
checkType('_main', 1, page, 'string', true)
Line 48:
if isShowingPage then
page = page or title.prefixedText
if displaytitleoptions.display and displaytitleoptions.display ~= '' then
if normalizeTitle(displaytitleoptions.display) == normalizeTitle(page) then
display = displaytitleoptions.display .. ' ' .. display
else
error(string.format(
'Display title "%s" was ignored since it is ' ..
"not equivalent to the page's actual title",
displaytitleoptions.display
), 0)
end
Line 106:
 
-- Sort the arguments.
local page, displaytitle
local sections, options = {}, {}
for k, v in pairs(args) do
Line 115:
elseif type(k) == 'number' then
sections[k] = v
elseif k == 'display' then
displaytitle = v
else
options[k] = v
Line 142 ⟶ 140:
sections = compressArray(sections)
 
return p._main(page, sections, options, nil, displaytitle)
end
 
Anonymous user