Module:Section link: Difference between revisions

Detect anchors in page parameter, other code cleanup
(implement display= parameter)
(Detect anchors in page parameter, other code cleanup)
Line 12:
 
local function normalizeTitle(title)
title = mw.ustring.gsub(mw.ustring.gsub(title,"'",""),'"','')
title =return mw.title.new(mw.ustring.gsub(title,'"'%b<>",''"")).prefixedText
title = mw.ustring.gsub(title,"%b<>","")
return mw.title.new(title).prefixedText
end
 
Line 50 ⟶ 48:
if isShowingPage then
page = page or title.prefixedText
if displaytitle and displaytitle ~= '' then
if normalizeTitle(displaytitle) == normalizeTitle(page) then
display = displaytitle .. ' ' .. display
Line 122 ⟶ 120:
options[k] = v
end
end
-- Extract section from page, if present
if page then
local p, s = page:match('^(.-)#(.*)$')
if p then page, sections[1] = p, s end
end
 
Anonymous user