Module:xchc-noun: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 44: | Line 44: | ||
backh = word:match("ɛ") and "ɛ" or word:match("ɔ") and "ɔ" or nil | backh = word:match("ɛ") and "ɛ" or word:match("ɔ") and "ɔ" or nil | ||
local singular = word | local singular = word | ||
local paucal = wordpron:matchEnd("[eiøy]") and "ч" or wordpron:matchEnd("[ɛa]") and "н" or wordpron:matchEnd("[uoɔ]") and "ӈ" or gsubh("Vӈ", "о̆", "э̆", "о̆") | local paucal = wordpron:matchEnd("[eiøy]") and "ч" | ||
or wordpron:matchEnd("[ɛa]") and "н" | |||
or wordpron:matchEnd("[uoɔ]") and "ӈ" | |||
or gsubh("Vӈ", "о̆", "э̆", "о̆") | |||
local plural = { | local plural = { | ||
["i"] = wordpron:matchEnd(voiceless) and gsubh("фVд","ө","э","э") or gsubh("вVд","ө","э","э"), | ["i"] = wordpron:matchEnd(voiceless) and gsubh("фVд","ө","э","э") or gsubh("вVд","ө","э","э"), |
Revision as of 13:35, 7 December 2023
- The following documentation is located at Module:xchc-noun/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local sub = mw.ustring.sub
local find = mw.ustring.find
local match = mw.ustring.match
local gmatch = mw.ustring.gmatch
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local split = mw.text.split
local gsplit = mw.text.gsplit
local m_tr = require('Module:xchc-translit')
local m_ipa = require('Module:xchc-pron')
local lang = require('Module:languages').getByCode("xchc")
local export = {}
local voiced = "mnɲŋbdɡvzʒɣlr"
local voiceless = "ptkfsʃxh"
local consonant = "[" .. voiced .. voiceless .. "]"
local vowel = "[aeɛioɔuyø]"
local function matchEnd(foo, pat)
return foo:match(pat .. "ː?$")
end
local function gsubh(word, o, e, def)
local repl = {["ɛ"] = e, ["ɔ"] = o}
return word:gsub("V", repl[backh] or def)
end
function export.show(frame)
local parent_args = frame:getParent().args
local numbers = {}
local decl = {}
local g = NAMESPACE == "Template" and "a" or parent_args[1]
local word = NAMESPACE == "Template" and "өра̄" or parent_args["word"] or PAGENAME
local unc = parent_args["unc"] or false
local args = {}
if g ~= "i" and g ~= "a" then error("Unknown gender: it must be either ‘i’ or ‘a’") end
local wordpron = m_ipa.crux(word)
backh = word:match("ɛ") and "ɛ" or word:match("ɔ") and "ɔ" or nil
local singular = word
local paucal = wordpron:matchEnd("[eiøy]") and "ч"
or wordpron:matchEnd("[ɛa]") and "н"
or wordpron:matchEnd("[uoɔ]") and "ӈ"
or gsubh("Vӈ", "о̆", "э̆", "о̆")
local plural = {
["i"] = wordpron:matchEnd(voiceless) and gsubh("фVд","ө","э","э") or gsubh("вVд","ө","э","э"),
["a"] = wordpron:matchEnd(voiceless) and gsubh("шVд","о̆","э̆","о̆") or gsubh("жVд","о̆","э̆","о̆"),
}
end
local navframe = [=[
<div class="mw-collapsible" style="border-collapse: collapse; margin: 0px 0px -1px 0px; padding: 2px; border: 1px solid #aaaaaa; text-align: center; font-size: 95%; overflow: auto; min-width: 70em; display:inline-block;">
<div style="min-height: 1.6em; font-size: 100%; text-align: left; background-color:#DEE9FB; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF); background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);">'''''{title}'''''<span style="font-weight:normal;">{after_title}</span> </div>
<div class="mw-collapsible-content" style="font-size: 100%;">
]=]
return export