Module:siwa-noun/data: Difference between revisions

Jump to navigation Jump to search
no edit summary
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", "ỉ"},
["aa"] = "ả", ["ee"] = "ẻ", ["ii"] = "ỉ",
{"oo", "ỏ"}, {"uu", "ủ"}, {"yy", "ỷ"},
["oo"] = "ỏ", ["uu"] = "ủ", ["yy"] = "ỷ",
}
}
Line 807: Line 813:
end
end
data.forms["m"][1] = gsub(data.forms["m"][1], dtl[1], dtl[2])
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
})
})

Navigation menu