1,124
edits
Line 25: | Line 25: | ||
end | end | ||
function com. | function com.modulePagename(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 | ||
local check = disambig | |||
while check do | |||
local check = string.find(title, '%(', check + 1) | |||
if check ~= 0 then | |||
disambig = check | |||
end | |||
end | end | ||
end | end | ||
title = string.sub(title, 1, | 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 |