45,647
edits
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
local function exactly(source, pattern) | local function exactly(source, pattern) | ||
return source:match("^" .. pattern .. "$") | return source:match("^" .. pattern .. "$") | ||
end | |||
local function same(foo, bar) | |||
foo, bar = mw.ustring.toNFD(foo), mw.ustring.toNFD(bar) -- decompose diacritics | |||
foo, bar = match(foo, "^."), match(bar, "^.") -- sort out the letter | |||
return foo == bar and true or false | |||
end | end | ||
Line 787: | Line 793: | ||
local dtl = { | local dtl = { | ||
["aa"] = "ả", ["ee"] = "ẻ", ["ii"] = "ỉ", | |||
["oo"] = "ỏ", ["uu"] = "ủ", ["yy"] = "ỷ", | |||
} | } | ||
Line 807: | Line 813: | ||
end | end | ||
local vv = match(data.forms["m"][1], v .. v) | |||
if same(vv) then | |||
data.forms["m"][1] = gsub(data.forms["m"][1], vv, dtl[vv]) | |||
end | |||
end | end | ||
}) | }) |