Module:siwa-pron: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
local m_su = require("Module:string utilities") | local m_su = require("Module:string utilities") | ||
local m_table = require("Module:table") | local m_table = require("Module:table") | ||
local m_sm = | local m_sm = require("Module:siwa-pron/data") | ||
local sub = mw.ustring.sub | local sub = mw.ustring.sub |
Revision as of 18:16, 7 January 2021
- The following documentation is located at Module:siwa-pron/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local m_IPA = require("Module:IPA")
local m_su = require("Module:string utilities")
local m_table = require("Module:table")
local m_sm = require("Module:siwa-pron/data")
local sub = mw.ustring.sub
local find = mw.ustring.find
local gmatch = mw.ustring.gmatch
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local split = mw.text.split
function export.morphemes(word)
local pss = {}
if gmatch(word,"·") then
pss = split(word,"·")
end
for i, m in ipairs(pss) do
if m_sm.suffix[m] and gmatch(table.concat(pss),"[ˈˌ]") then
elseif m_sm.prefix[m] then
pss[i] = "ˌ" .. pss[i]
else
pss[i] = "ˈ" .. pss[i]
end
end
return table.concat(pss,"·")
end
function export.crux(term)
local IPA = {}
local rules = m_sm.rules
term=mw.ustring.lower(term)
term=export.morphemes(term)
for _, rule in ipairs(m_sm.rules) do
for regex, replacement in pairs(rule) do
term = gsub(term, regex, replacement)
end
end
table.insert(IPA, term)
return table.concat(IPA)
end
function export.show(frame)
local parent_args = frame:getParent().args
local params = {
[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "uįo·sauṡṡi" or mw.title.getCurrentTitle().text },
}
local args = require("Module:parameters").process(parent_args, params)
local term = args[1]
local ipa = export.crux(term)
local IPA_key = "IPA for Siwa"
local key_link = "[[".. IPA_key .."|key]]"
local prefix = "[[w:IPA chart|IPA]]<sup>(" .. key_link .. ")</sup>: "
local accent="(\''Aingo\'') "
ipa = "<span style=\"font-size:110%;font-family:Gentium,'DejaVu Sans','Segoe UI',sans-serif>[" .. ipa .. "]</span>"
ipa = accent..prefix..ipa
return ipa
end
return export