Difference between revisions of "Module:Common"

Jump to navigation Jump to search
125 bytes added ,  16:56, 11 August 2022
no edit summary
Line 25: Line 25:
end
end


function com.pagename(frame)
function com.modulePagename(title)
local args = a.getArgs(frame)
local title = args['title']
if not title then
if not title then
title = mw.title.getCurrentTitle()
title = mw.title.getCurrentTitle()
Line 33: Line 31:
local disambig = string.find(title, '%(')
local disambig = string.find(title, '%(')
local check = disambig
if string.sub(title, string.length(title)) == '%)' then
while check do
local check = disambig
local check = string.find(title, '%(', check + 1)
while check do
if check ~= 0 then
local check = string.find(title, '%(', check + 1)
disambig = check
if check ~= 0 then
disambig = check
end
end
end
end
end
title = string.sub(title, 1, check)
title = string.sub(title, 1, disambig)
return title
return title
end
function com.pagename(frame)
local args = a.getArgs(frame)
return com.modulePagename(args['title'])
end
end


return com
return com

Navigation menu