تضامنًا مع حق الشعب الفلسطيني |
وحدة:ملعب/Mr. Ibrahem/replace
< وحدة:ملعب | Mr. Ibrahem
توثيق الوحدة[أنشئ] [محو الاختزان][استخدامات] [قوالب]
local p = {}
p.sentence = function (frame )
local s = mw.text.trim( frame.args[1] or "" )
local words = mw.text.split( s, "|")
mw.log( "#words: " .. #words )
for i, s in ipairs(words) do
mw.log( i .. s)
if( i > 1 ) then
if( alwayslower[s] ~= 1 ) then
s = mw.getContentLanguage():ucfirst(s)
end
else
s = mw.getContentLanguage():ucfirst(s)
end
words[i] = s
end
if string.find(s, "^%[%[[^|]+|[^%]]+%]%]") then
-- this is a piped wikilink, so we capitalise the text, not the pipe
local b, c = string.find(s, "|%A*%a") -- find the first letter after the pipe
return string.sub(s, 1, c-1) .. string.upper(string.sub(s, c, c)) .. string.sub(s, c+1)
end
local letterpos = string.find(s, '%a')
if letterpos then
local first = string.sub(s, 1, letterpos - 1)
local letter = string.sub(s, letterpos, letterpos)
local rest = string.sub(s, letterpos + 1)
return first .. string.upper(letter) .. string.lower(rest)
else
return s
end
end
return p