Module:String2/sandbox: Difference between revisions

Content deleted Content added
Create sandbox version of Module:String2
 
deal with piped wikilinks
Line 13:
p.sentence = function (frame )
local s = mw.text.trim( frame.args[1] or "" )
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