Module:zm-pron: Difference between revisions
Jump to navigation
Jump to search
Aleisi Galan (talk | contribs) No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
-- To avoid weird annoying cursor behavior | -- To avoid weird annoying cursor behavior | ||
local GRAVE = u(0x0300) -- COMBINING GRAVE ACCENT ̀◌ | local GRAVE = u(0x0300) -- COMBINING GRAVE ACCENT ̀◌ | ||
local | local ACUTE = u(0x0301) -- COMBINING ACUTE ACCENT | ||
local SYLL = u(0x0329) -- COMBINING VERTICAL LINE BELOW ̩◌ | |||
local | local VL = u(0x0325) -- COMBINING RING BELOW ̥◌ | ||
local | |||
local AFFR = u(0x0361) -- COMBINING DOUBLE INVERTED BREVE ͡ | local AFFR = u(0x0361) -- COMBINING DOUBLE INVERTED BREVE ͡ | ||
Line 24: | Line 18: | ||
local front_vowel = "ieɛ" | local front_vowel = "ieɛ" | ||
local vowel = "[" .. back_vowel .. front_vowel .. "]" | local vowel = "[" .. back_vowel .. front_vowel .. "]" | ||
local | local acuted = "[áéíóú]" | ||
local palatal = "[ʨjʎʃʒʥʤʧ]" | local palatal = "[ʨjʎʃʒʥʤʧ]" | ||
local sonorant = "[rl]" | local sonorant = "[rl]" | ||
local consonant = "[mnptkbdɡfvszxrljɲŋʋʎʨjʎʃʒʥʤʧʤʣ]" | |||
local consonant = "[ | |||
local export = {} | local export = {} | ||
local rules = { | local rules = { | ||
{"ai", "ɛ"}, {"au", "ɔ"}, {"è", "ɛ"}, {"ò", "ɔ"}, | |||
{"dź", "ʥ"}, {"dž", "ʤ"}, {"ć", "ʨ"}, {"nj", "ɲ"}, {"č", "ʧ"}, {"ž", "ʒ"}, {"š", "ʃ"}, {"lj", "ʎ"}, | |||
{" | {"h", "x"}, {"g", "ɡ"}, | ||
{"(" .. vowels .. ")[lv]$", "%1ʋ"}, {"(" .. acute_vowels .. ")[lv]$", "%1ʋ"}, | |||
{"(" .. | |||
{" | {"(" .. consonants ..")r(" .. consonants ..")", "%1(ə)r" .. SYLL .. "%2"} | ||
, | , | ||
{"(" .. palatal .. ")e", " | {"(" .. palatal .. ")e", "%1ɛ"}, {"(" .. palatal .. ")é", "%1ɛ" .. ACUTE}, | ||
{"(" .. palatal .. ")o", "%1ɔ"}, {"(" .. palatal .. ")ó", "%1ɔ" .. ACUTE}, | |||
{"(" .. | |||
} | } | ||
function export.crux(term) | function export.crux(term) | ||
term = mw.ustring.lower(term) | term = mw.ustring.lower(term) | ||
Line 131: | Line 58: | ||
function format_IPA(items) | function format_IPA(items) | ||
return "[[w:IPA chart|IPA]]<sup>([[IPA for | return "[[w:IPA chart|IPA]]<sup>([[IPA for Zemljask|key]])</sup>: " .. IPA_span(items) | ||
end | end | ||
function line_format(pronunciation) | function line_format(pronunciation, register) | ||
local full_pronunciations = {} | local full_pronunciations = {} | ||
local IPA_args = {{pron = '[' .. pronunciation .. ']'}} | local IPA_args = {{pron = '[' .. pronunciation .. ']'}} | ||
table.insert(full_pronunciations, format_IPA(IPA_args)) | table.insert(full_pronunciations, format_IPA(IPA_args)) | ||
return table.concat(full_pronunciations) | return "(''" .. table.concat(register, ", ") .. "'')" .. ' ' .. table.concat(full_pronunciations, ' or ') | ||
end | end | ||
Line 153: | Line 80: | ||
function export.show(frame) | function export.show(frame) | ||
local params = { | local params = { | ||
[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and " | [1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "dźelo" or mw.title.getCurrentTitle().text }, | ||
} | } | ||
local args = require("Module:parameters").process(frame:getParent().args, params) | local args = require("Module:parameters").process(frame:getParent().args, params) | ||
Line 159: | Line 86: | ||
local ipa = "* " | local ipa = "* " | ||
ipa = ipa .. line_format(separate_word(term)) | ipa = ipa .. line_format(separate_word(term), {'Standard'}) | ||
return ipa | return ipa |