Module:String2/sandbox: Difference between revisions

Content deleted Content added
fix issue with named parameters
Remove upper and lower functions and make sentence and title strip-marker safe.
Line 2:
 
p.trim = function(frame)
local s =return mw.text.trim(frame.args[1] or "")
return s
end
 
p.uppersentence = function (frame)
-- {{lc:}} is strip-marker safe, string.lower is not.
local s = mw.text.trim(frame.args[1] or "")
frame.args[1] = string.lowerframe:callParserFunction('lc', frame.args[1])
return string.upper(s)
end
 
p.lower = function(frame)
local s = mw.text.trim(frame.args[1] or "")
return string.lower(s)
end
 
p.sentence = function (frame )
frame.args[1] = string.lower(frame.args[1])
return p.ucfirst(frame)
end
Line 63 ⟶ 53:
local words = mw.text.split( s, " ")
for i, s in ipairs(words) do
s-- ={{lc:}} is strip-marker safe, string.lower( sis )not.
s = frame:callParserFunction('lc', s)
if( i >== 1 andor alwayslower[s] =~= 1) then
-- leave in lowercase
else
s = mw.getContentLanguage():ucfirst(s)
end