Content deleted Content added
break it |
if it's a list chop off and (store as s1) everything up to the first <li> |
||
Line 13:
p.sentence = function (frame )
local s = mw.text.trim( frame.args[1] or "" )
local s1 = ""
-- if it's a list chop off and (store as s1) everything up to the first <li>
local lipos = string.find(s, "<li>" )
if lipos then
s end
-- s1 is either "" or the first part of the list markup, so we can continue
-- and prepend s1 to the returned string
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 s1 .. 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')
Line 27 ⟶ 32:
local letter = string.sub(s, letterpos, letterpos)
local rest = string.sub(s, letterpos + 1)
return s1 .. first .. string.upper(letter) .. string.lower(rest)
else
return s
|