Difference between revisions of "Module:Common"

Jump to navigation Jump to search
760 bytes added ,  18:59, 7 February 2024
no edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
local a = require('Module:Arguments')
local com = {}
local com = {}


Line 22: Line 23:
return true
return true
end
end
end
function com.modulePagename(title)
if not title then
title = mw.title.getCurrentTitle().text
end
mw.log(title)
local disambig = string.find(title, '%(')
if disambig then
title = title:gsub('(.*)%s%(.-%)', '%1')
end
return title
end
function com.pagename(frame)
local args = a.getArgs(frame)
return com.trim(com.modulePagename(args['title']))
end
function com.fUpper(text)
local words = mw.text.split(text, '%s')
for k, v in ipairs(words) do
words[k] = v:sub(1,1):upper() .. (v:sub(2) or '')
end
return table.concat(words, ' ')
end
function com.firstUpper(frame)
local args = a.getArgs(frame)
return string.gsub(args[1], string.sub(args[1],1,1), string.upper(
string.sub(args[1],1,1)))
end
end


return com
return com

Navigation menu