Module:IPAc2-mh: Difference between revisions

Content deleted Content added
Uncaching the library functions, per User:Erutuon's performance analysis.
Removed certain defunct experimental code.
Line 4:
-- The version of this script on Wikipedia is only a mirror.
 
local IMPLIED_SECONDARIESexport = true{}
 
local MERGED_VOWELS = false
local PARENTHETICAL_EPENTHESIS = true
local PHONETIC_DETAILS = false
local W_OFF_GLIDES = true
 
local export = {}
 
local ASYLL = "̯"
Line 32 ⟶ 31:
local EMPTY = {}
 
-- Adds elements to a sequence as if it's a set (retains unique elements only).
local function addUnique(seq, value)
for _, value2 in pairs(seq) do
Line 41:
end
 
-- Intended to work the same as JavaScript's Object.assign() function.
local function assign(target, ...)
local args = { ... }
Line 54 ⟶ 55:
 
local function fastTrim(text)
return string.submatch(text, 1, "^%s*(.-2)%s*$")
if text == "" or text == " " then
return ""
else
local atLeft = string.byte(text) == 32
local atRight = string.byte(text, -1) == 32
if atLeft then
if atRight then
return string.sub(text, 2, -2)
else
return string.sub(text, 2)
end
elseif atRight then
return string.sub(text, 1, -2)
else
return text
end
end
end
 
Line 1,277 ⟶ 1,262:
end
end
if IMPLIED_SECONDARIES then
if PARENTHETICAL_EPENTHESIS then
text = string.gsub(text, "(.@)", "/%1")
if diphthongs then
text = string.gsub(text, "(.=.@)", "/%1")
end
end
if PARENTHETICAL_EPENTHESIS then
text = string.gsub(text, "/", "")
end
end
Line 1,301 ⟶ 1,273:
-- Convert remaining word gaps to liaison.
text = string.gsubfastTrim(text, "^ *", "")
text = string.gsub(text, " *$", "")
text = string.gsub(text, " +", false and "_" or "")