wiki/templates/utils/lang-mos.typ
2026-01-23 22:30:50 +01:00

188 lines
7.4 KiB
Typst
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#import "/templates/base.typ"
#let mos-sec = [
= Mosici <mos>
#base.tag("word") #base.tag("mos")
]
#let sn = base.s.with("nahan")
#let mos-pro(ipa) = [
- #base.wl("/worlds/Asteron/Mosici", [Standard], none) [#ipa]
]
#let mos-translit(s) = {
s
.replace("", "a")
.replace("", "á")
.replace("", "c")
.replace("", "e")
.replace("", "é")
.replace("", "f")
.replace("", "h")
.replace("", "i")
.replace("", "í")
.replace("", "l")
.replace("", "m")
.replace("", "n")
.replace("", "o")
.replace("", "ó")
.replace("", "p")
.replace("", "r")
.replace("", "s")
.replace("", "t")
.replace("", "u")
.replace("", "v")
.replace("", "z")
.replace("", ",")
.replace("", "·")
.replace("", "")
}
#let mos-cit(t) = [#sn(t) #html.span(class: "low", mos-translit(t))]
#let mos-nstem(w) = {
if w.ends-with("") { (w.clusters().slice(0, -2).join(), "") } else if w.ends-with("") {
(w.clusters().slice(0, -2).join(), "")
} else if w.ends-with("") { (w.clusters().slice(0, -2).join(), "") } else if w.ends-with("") {
(w.clusters().slice(0, -2).join(), "")
} else if w.ends-with("") { (w.clusters().slice(0, -1).join(), "") } else if w.ends-with("") {
(w.clusters().slice(0, -1).join(), "")
} else { (w, "") }
}
#let mos-vstem(w) = w.clusters().slice(0, -1).join()
#let mos-pluralise(w) = {
// find index of last vowel
let revw = w.rev()
let pos = revw.position(regex("[]"))
let v = revw.at(pos)
if v == "" { v = "" }
if v == "" { v = "" }
if v == "" { v = "" }
if v == "" { v = "" }
revw = revw.slice(0, pos) + v + revw.slice(pos)
revw.rev()
}
#let mos-n(sg, pl: none, open: false) = {
let pr = if pl == false { "" } else if pl != none { pl } else { mos-pluralise(sg) }
let (ps, pv) = mos-nstem(pr)
let (ss, sv) = mos-nstem(sg)
let c(it) = [#base.s("nahan", it) \ #html.span(class: "low", mos-translit(it))]
html.details(open: open, {
html.summary[
*Declension for* _#mos-cit(sg)_ #if pl != none and pl != false [*Irr. pl. stem* _#mos-cit(pl)_] else if (
pl == false
) [*(Uncountable)*]]
table(
columns: if pl != false { 3 } else { 2 },
..if pl != false { ([], base.sc[*sg*], base.sc[*pl*]) } else { () },
base.sc[*age*], c(sg), ..if pl != false { (c(pr),) } else { () },
base.sc[*pat*], c(ss + ""), ..if pl != false { (c(ps + ""),) } else { () },
base.sc[*gen*], c(ss + ""), ..if pl != false { (c(ps + ""),) } else { () },
base.sc[*dat*], c(ss + sv + ""), ..if pl != false { (c(ps + pv + ""),) } else { () },
base.sc[*abl*], c(ss + ""), ..if pl != false { (c(ps + ""),) } else { () },
)
})
}
#let mos-v(w, open: false) = {
let s = mos-vstem(w)
let c(it) = [#base.s("nahan", it) \ #html.span(class: "low", mos-translit(it))]
html.details(open: open, {
html.summary[*Conjugation for* _#mos-cit(w)_]
table(
columns: 5,
[], base.sc[*prs*], base.sc[*pst*], base.sc[*fut*], base.sc[*gno*],
base.sc[*1s*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*2s*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*3sa*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*3si*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*1pi*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*1pe*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*2p*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*3pa*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*3pi*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*inf*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*pcp.sg*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
base.sc[*pcp.pl*], c(s + ""), c(s + ""), c(s + ""), c(s + ""),
)
})
}
#let mos-pron(this, open: false) = {
let c(k, h: false) = if h and k != this [
#base.wl("/dict/" + mos-translit(k), base.s("nahan", k), "mos") \ #html.span(class: "low", mos-translit(k))
] else [
#base.s("nahan", k) \ #html.span(class: "low", mos-translit(k))
]
html.details(open: open, {
html.summary[Mosici Pronouns]
table(
columns: 6,
[], base.sc[*age*], base.sc[*pat*], base.sc[*gen*], base.sc[*dat*], base.sc[*abl*],
base.sc[*1s*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*1p*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*2s*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*2p*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*3sa*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*3pa*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*3si*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*3pi*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*dem.sg*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*dem.pl*], c(h: true, ""), c(""), c(""), c(""), c(""),
base.sc[*q*], c(h: true, ""), c(""), c(""), c(""), c(""),
)
})
}
#let nahan-numeral(n) = {
let res = ()
while n > 6 {
res = (..res, calc.rem-euclid(n, 6))
n = calc.div-euclid(n, 6)
}
if n != 0 { res = (..res, n) }
for _ in range(res.len()) {
for i in range(res.len() - 1, -1, step: -1) {
if (res.at(i) == 0 and i != res.len() - 1 and res.at(i + 1) != 0) {
res = (..res.slice(0, i), 6, res.at(i + 1) - 1, ..res.slice(i + 2))
}
}
}
sn(res.map(it => ("", "", "", "", "", "", "").at(it)).join(""))
}
#let num-nahan-sh(..nums) = nums.pos().map(nahan-numeral).join(sn[])
#let num-nahan-let(..nums) = {
let base13 = (
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
"a": 10,
"b": 11,
"c": 12,
)
let res = nums
.pos()
.map(it => str(it, base: 13))
.map(str.clusters)
.map(it => it.map(this => base13.at(this)))
.map(it => {
for _ in range(it.len()) {
for i in range(1, it.len()) {
if (it.at(i) == 0 and it.at(i - 1) != 0) {
it = (..it.slice(0, i - 1), it.at(i - 1) - 1, 13, ..it.slice(i + 1))
}
}
}
let letters = ("", "", "", "", "", "", "", "", "", "", "", "", "", "")
sn(it.map(this => letters.at(this)).join())
})
res.join(sn[])
}