Module:siwa-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 19: Line 19:
local consonant = "[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦʔƀꝺđɣꬶɉ]" .. UNRELEASED .. "?"
local consonant = "[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦʔƀꝺđɣꬶɉ]" .. UNRELEASED .. "?"
local front_vowel = "iɪyeøɛœæa"
local front_vowel = "iɪyeøɛœæa"
local back_vowel = "uɔ" .. NASALIZED .. "?ɑʊ"
local back_vowel = "uɔ" .. NASALIZED .. "?ɑʊɤ"
local vowel = "[" .. front_vowel .. back_vowel .. "ɨ]"
local vowel = "[" .. front_vowel .. back_vowel .. "ɨ]"


Line 27: Line 27:
local spat4 = "(·?ˈ[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦ⁽ʰ⁾ʔːƀꝺđɣꬶɉ]*"..UNRELEASED.."?"..vowel..")(đ)([^ː])"
local spat4 = "(·?ˈ[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦ⁽ʰ⁾ʔːƀꝺđɣꬶɉ]*"..UNRELEASED.."?"..vowel..")(đ)([^ː])"
local spat5 = "(·?ˈ[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦ⁽ʰ⁾ʔːƀꝺđɣꬶɉ]*"..UNRELEASED.."?"..vowel..")(ꝺ)([^ː])"
local spat5 = "(·?ˈ[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦ⁽ʰ⁾ʔːƀꝺđɣꬶɉ]*"..UNRELEASED.."?"..vowel..")(ꝺ)([^ː])"
local function ncategories(categories)
local out_categories = {}
for key, cat in ipairs(categories) do
out_categories[key] = "[[Category:" .. cat .. "]]"
end
return table.concat(out_categories, "")
end


local function open_to_closed(v, a)
local function open_to_closed(v, a)
Line 245: Line 255:
return table.concat(IPA)
return table.concat(IPA)
end
end
local function format_dialect(term, dialect)
local function IPA_format(items)
local bits = {}
local prefix = "[[w:IPA chart|IPA]]<sup>([[IPA for Siwa|key]])</sup>:&#32;"
local span = "<span style=\"font-size:110%;font-family:Gentium,'DejaVu Sans','Segoe UI',sans-serif>"
for _, item in ipairs(items) do
local bit = item.pron
table.insert(bits, bit)
end
return prefix .. span .. items.pron .. "</span>"
end
local prons = {}
for _, done in ipairs(replaced) do
local phonetic = replaced[1]
local IPA_args = {{pron = '[' .. phonetic .. ']'}}
table.insert(prons, IPA_format(IPA_args))
end
return "(''"..dialect.."'') " .. table.concat(prons, ' or ')
end


function export.show(frame)
function export.show(frame)
local parent_args = frame:getParent().args
local params = {
local params = {
[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "uįo·sauṡṡi" or mw.title.getCurrentTitle().text },
[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "uįo·sauṡṡi" or mw.title.getCurrentTitle().text },
a = {type = 'boolean', default = true},
e = {type = 'boolean', default = true},
w = {type = 'boolean', default = true},
acc = {list = true},
}
}
local args = require("Module:parameters").process(parent_args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local term = args[1]
local term = args[1]
local accent = args.acc
local categories = {}
local ipa = export.crux(term)
local ipa = "* "
if args.a then
ipa = ipa .. format_dialect(export.crux(term, false, false), accent and #accent > 0 or {'Aingo'})
end
local IPA_key = "IPA for Siwa"
if args.e then
local key_link = "[[".. IPA_key .."|key]]"
if args.a then
 
ipa = ipa .. "\n* "
local prefix = "[[w:IPA chart|IPA]]<sup>(" .. key_link .. ")</sup>:&#32;"
end
local accent="(\''Aingo\'') "
out = out .. format_dialect(export.crux(term, true, false), accent and #accent > 0 or {'Eastern'})
table.insert(categories, "Siwa terms with Eastern IPA pronunciation")
end
ipa = "<span style=\"font-size:110%;font-family:Gentium,'DejaVu Sans','Segoe UI',sans-serif>[" .. ipa .. "]</span>"
if args.w then
ipa = accent..prefix..ipa
if args.a or args.e then
ipa = ipa .. "\n* "
end
ipa = ipa .. format_dialect(export.crux(term, false, true), accent and #accent > 0 or {'Western'})
table.insert(categories, "Siwa terms with Western IPA pronunciation")
end
return ipa
return ipa .. ncategories(categories)
end
end


return export
return export