Module:R:be:Verbum
Appearance
- The following documentation is generated by Module:documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module implements the reference template {{R:be:Verbum}}
.
-- This module is intended to support making references to https://verbum.by dictionaries
local export = {}
local subst_tbl = {
["А"] = "A",
["а"] = "a",
["Б"] = "B",
["б"] = "b",
["В"] = "V",
["в"] = "v",
["Г"] = "H",
["г"] = "h",
["Д"] = "D",
["д"] = "d",
["Ж"] = "Zh",
["ж"] = "zh",
["З"] = "Z",
["з"] = "z",
["І"] = "I",
["і"] = "i",
["Й"] = "J",
["й"] = "j",
["К"] = "K",
["к"] = "k",
["Л"] = "L",
["л"] = "l",
["М"] = "M",
["м"] = "m",
["Н"] = "N",
["н"] = "n",
["О"] = "O",
["о"] = "o",
["П"] = "P",
["п"] = "p",
["Р"] = "R",
["р"] = "r",
["С"] = "S",
["с"] = "s",
["Т"] = "T",
["т"] = "t",
["У"] = "U",
["у"] = "u",
["Ў"] = "U",
["ў"] = "u",
["Ф"] = "F",
["ф"] = "f",
["Х"] = "Ch",
["х"] = "ch",
["Ц"] = "C",
["ц"] = "c",
["Ч"] = "Ch",
["ч"] = "ch",
["Ш"] = "Sh",
["ш"] = "sh",
["'"] = "",
["ʼ"] = "",
["’"] = "",
["Ы"] = "Y",
["ы"] = "y",
["Ь"] = "",
["ь"] = "",
["Э"] = "E",
["э"] = "e",
["е"] = "je",
["ё"] = "jo",
["ю"] = "ju",
["я"] = "ja",
["Е"] = "Je",
["Ё"] = "Jo",
["Ю"] = "Ju",
["Я"] = "Ja",
}
local subst_tbl_after_consonant = {
["е"] = "ie",
["ё"] = "io",
["ю"] = "iu",
["я"] = "ia",
["Е"] = "ie",
["Ё"] = "io",
["Ю"] = "iu",
["Я"] = "ia",
}
-- Lua implementation of https://github.com/verbumby/verbum/blob/master/backend/textutil/romanize_belarusian.go
function export.RomanizeBelarusian(frame)
local params = {
[1] = {required = true},
}
local args = require("Module:parameters").process(frame.args, params)
local s = args[1]
s = mw.ustring.gsub(s, "([БВГДЖЗЙКЛМНПРСТЎФХЦЧШЬбвгджзйклмнпрстўфхцчшь]?)([еёюяЕЁЮЯ])", function (prev, cur)
if prev == "" then
return cur
else
return prev .. subst_tbl_after_consonant[cur]
end
end)
s = mw.ustring.gsub(s, ".", subst_tbl)
return s
end
return export