Module:Capitalize: Difference between revisions
Jump to navigation
Jump to search
(cap after the tags) |
m (1 revision imported) |
(No difference)
|
Latest revision as of 13:24, 11 December 2023
Documentation for this module may be created at Module:Capitalize/doc
local p = {}
function p.cap(str)
lang = mw.getContentLanguage()
if lang:ucfirst(str) ~= str then
return lang:ucfirst(str)
else
local substr = mw.ustring.sub
b, e = mw.ustring.find(str, ">%s*%a")
while e ~= nil do
if mw.ustring.find(">", substr(str, b,e)) == nil then
return substr(str, 1, e-1) .. lang:ucfirst(substr(str,e,e)) ..substr(str, e+1)
end
b, e = mw.ustring.find(str, ">%s*%a", e)
end
return str
end
end
function p.capitalize(frame) return p.cap(frame.args[1]) end
return p