Module:qlu-pron: Difference between revisions
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
local match = mw.ustring.match | local match = mw.ustring.match | ||
local u = mw.ustring.char | local u = mw.ustring.char | ||
local split = mw.text.split | --local split = mw.text.split | ||
local gsplit = mw.text.gsplit | local gsplit = mw.text.gsplit | ||
| Line 21: | Line 21: | ||
local back = "uoɔʊʌɑɒ" | local back = "uoɔʊʌɑɒ" | ||
local vowels = "[aɐ" .. front .. back .. "ːjw]" | local vowels = "[aɐ" .. front .. back .. "ːjw]" | ||
local function split(text, pattern, plain) | |||
local ret = {} | |||
local s, l = 1, string.len( text ) | |||
while s do | |||
local e, n = string.find( text, pattern, s, plain ) | |||
if not e then | |||
ret[#ret+1] = string.sub ( text, s ) | |||
s = nil | |||
elseif n < e then | |||
-- Empty separator! | |||
ret[#ret+1] = string.sub ( text, s, e ) | |||
if e < l then | |||
s = e + 1 | |||
else | |||
s = nil | |||
end | |||
else | |||
ret[#ret+1] = e > s and string.sub( text, s, e - 1 ) or '' | |||
s = n + 1 | |||
end | |||
end | |||
return ret | |||
end | |||
local function laxen(v) | local function laxen(v) | ||