Moduuli:eo-johdos
Moduulin eo-johdos käyttöohje [näytä tämä käyttöohje omalla sivullaan] [muokkaa tätä käyttöohjetta] [päivitä] [testit] [hiekkalaatikko]
- (abon+ebl+a ← abon+i)
- (ne+mal+hav+ebl+a ← hav+i)
- (komenc+iĝ+i ← komenc+i)
- KOODI: {{#invoke:eo-johdos|muotoile|in|a}}
TULOS: jälkiliitteestä in ja adjektiivin päätteestä -a
- (in+a)
-- Moduulilla voi merkitä esperanton sanan johtimet etymologiaosioon.
local tf = require("Module:tekstifunktiot")
-- Etuliitteet
local pref = {
-- Etuliitteet
"bo", "dis", "ek", "eks", "fi", "ge", "mal", "mis", "pra", "re",
-- Etuliitteiden tapaan käytettävät sanajuuret ja prepositiot
"al", "antaŭ", "apud", "ĉe",
"ĉef", "ĉi", "ĉia", "ĉiu", "ĉirkaŭ", "de", "du", "duon", "dum", "ekster", "el", "en", "for",
"fuŝ", "ĝis", "inter", "kilo", "kontraŭ", "krom", "kun", "kvazaŭ", "laŭ", "mem", "multe", "ne",
"nov", "per", "plej", "pli", "po", "por", "post", "preter", "pri", "pro", "retro", "sam", "sen",
"sin", "sub", "super", "tia", "tiu", "tra", "trans", "tri", "tro", "unu", "vic"
}
--Jälkiliitteet
local suff = {
"aĉ", "ad", "aĵ", "an", "ar", "ĉj", "ebl", "ec", "eg", "ej", "em", "end", "er", "estr", "et",
"id", "ig", "iĝ", "il", "in", "ind", "ing", "ism", "ist", "nj", "obl", "on", "op", "oz", "uj",
"ul", "um"
}
--Sanaluokkien päätteet
local sanaluokat = {}
sanaluokat["a"] = "adjektiivin päätteestä '''-a'''"
sanaluokat["e"] = "adverbin päätteestä '''-e'''"
sanaluokat["i"] = "verbin infinitiivin päätteestä '''-i'''"
sanaluokat["o"] = "substantiivin päätteestä '''-o'''"
local m = {}
function m.muotoile(frame)
local function l_liite(a) return "[[Liite:Esperanton liitteet#" .. a .. "|" .. a .. "]]" end
local function pilko_kantasana(a)
if mw.ustring.find(a, "^(.*)[aeio]$") then
return mw.ustring.match(a, "^(.*)[aeio]$") .. "+" .. mw.ustring.sub(a, -1, -1)
else
return a
end
end
local osat = {}
osat[1] = {}
osat[2] = {}
if frame:getParent().args["kanta"] ~= nil then
table.insert(osat[1], "Kantasanasta '''" .. frame:expandTemplate{title="l",
args={"eo", frame:getParent().args["kanta"]}} .. "'''")
end
for i1, v1 in ipairs(frame:getParent().args) do
local lisatty = false
if v1 ~= "muotoile" then
table.insert(osat[2], v1)
else
lisatty = true
end
if not lisatty then
for i2, v2 in ipairs(pref) do
if v1 == v2 then table.insert(osat[1], "etuliitteestä '''" .. l_liite(v1) .. "'''") lisatty = true end
end
end
if not lisatty then
for i2, v2 in ipairs(suff) do
if v1 == v2 then table.insert(osat[1], "jälkiliitteestä '''" .. l_liite(v1) .. "'''") lisatty = true end
end
end
if not lisatty then
for i2, v2 in pairs(sanaluokat) do
if v1 == i2 then table.insert(osat[1], v2) end
end
end
end
if frame:getParent().args["kanta"] ~= nil then
return tf.luettele(osat[1], ", ", " ja ") .. "\n:(" .. tf.luettele(osat[2], "+") .. " ← " ..
pilko_kantasana(frame:getParent().args["kanta"]) .. ")"
else
return tf.luettele(osat[1], ", ", " ja ") .. "\n:(" .. tf.luettele(osat[2], "+") .. ")"
end
end
return m