Module:qya-conj

local export = {}

local PAGENAME = mw.title.getCurrentTitle.text local tengwar = require("Module:tengwar")

function export.conjugate(frame) -- get arguments local args = frame:getParent.args local stem = frame.args[1]..'␃' or PAGENAME..'␃' stem = mw.ustring.gsub (stem, '[\-]?␃', '') local aor = export.aorist(stem) local pres = export.present(stem) local past = export.past(frame.args[2]) local perf = export.past(frame.args[3]) local fut = export.future(stem) return ' ' end

function export.show(text) return ''..tengwar.convert('qya', 'annatar', text)..' '..text end

function export.aorist(stem) stem = stem..'␃' stem = mw.ustring.gsub (stem, '([^au])␃', '%1ë␃') stem = mw.ustring.gsub (stem, 'u␃', 'ë␃') stem2 = mw.ustring.gsub (stem, '[^a]␃', 'i␃') stem = mw.ustring.gsub (stem, '␃', '') stem2 = mw.ustring.gsub (stem2, '␃', '') return {stem, stem2..'r'} end

function export.present(stem) stem = stem..'␃' local vow1 = {'a', 'e', 'i', 'o', 'u'} local vow2 = {'á', 'é', 'í', 'ó', 'ú'} for i=1, #vow1 do		stem = mw.ustring.gsub (stem, '([^aeiouäëö])'..vow1[i]..'([^aeiouäëö][au]?␃)', '%1'..vow2[i]..'%2') end stem = mw.ustring.gsub (stem, 'a␃', 'ë␃') stem = mw.ustring.gsub (stem, '␃', '') return {stem..'a', stem..'ar'} end

function export.past(stem) plur = mw.ustring.gsub (stem..'␃', 'ë( *[,␃])', 'e%1') plur = mw.ustring.gsub (plur, '( *[,␃])', 'r%1') plur = mw.ustring.gsub (plur, '␃', '') return {stem, plur} end

function export.future(stem) stem = stem..'u␃' stem = mw.ustring.gsub (stem, 'uu␃', 'ú␃') stem = mw.ustring.gsub (stem, 'au␃', 'u␃') stem = mw.ustring.gsub (stem, '␃', '') return {stem..'va', stem..'var'} end

return export