Module:tengwar/letter

local export = {}

local PAGENAME = mw.title.getCurrentTitle.text

function export.next(frame) local args = frame:getParent.args return export.letter(args[1]).next end

function export.previous(frame) local args = frame:getParent.args return export.letter(args[1]).previous end

function export.letter(text) -- define letters, pua = Unicode Private Use Area local letters = {} letters [0] = { name = 'tinco', pua = '\xe000' } letters [1] = { name = 'parma', pua = '\xe001' } letters [2] = { name = 'calma', pua = '\xe002' } letters [3] = { name = 'quessë', pua = '\xe003' } letters [4] = { name = 'ando', pua = '\xe004' } letters [5] = { name = 'umbar', pua = '\xe005' } letters [6] = { name = 'anga', pua = '\xe006' } letters [7] = { name = 'ungwë', pua = '\xe007' } letters [8] = { name = 'súlë', pua = '\xe008' } letters [9] = { name = 'formen', pua = '\xe009' } letters [10] = { name = 'aha', pua = '\xe00a' } letters [11] = { name = 'hwesta', pua = '\xe00b' } letters [12] = { name = 'anto', pua = '\xe00c' } letters [13] = { name = 'ampa', pua = '\xe00d' } letters [14] = { name = 'anca', pua = '\xe00e' } letters [15] = { name = 'unquë', pua = '\xe00f' } letters [16] = { name = 'númen', pua = '\xe010' } letters [17] = { name = 'malta', pua = '\xe011' } letters [18] = { name = 'noldo', pua = '\xe012' } letters [19] = { name = 'nwalmë', pua = '\xe013' } letters [20] = { name = 'órë', pua = '\xe014' } letters [21] = { name = 'vala', pua = '\xe015' } letters [22] = { name = 'anna', pua = '\xe016' } letters [23] = { name = 'vilya', pua = '\xe017' } letters [24] = { name = 'rómen', pua = '\xe020' } letters [25] = { name = 'arda', pua = '\xe021' } letters [26] = { name = 'lambë', pua = '\xe022' } letters [27] = { name = 'alda', pua = '\xe023' } letters [28] = { name = 'silmë', pua = '\xe024' } letters [29] = { name = 'silmë nuquerna', pua = '\xe025' } letters [30] = { name = 'essë', pua = '\xe026' } letters [31] = { name = 'essë nuquerna', pua = '\xe027' } letters [32] = { name = 'hyarmen', pua = '\xe028' } letters [33] = { name = 'hwesta sindarinwa', pua = '\xe029' } letters [34] = { name = 'yanta', pua = '\xe02a' } letters [35] = { name = 'úrë', pua = '\xe02b' } letters [36] = { name = 'ára', pua = '\xe02e' } letters [37] = { name = 'halla', pua = '\xe02c' } letters [38] = { name = 'telco', pua = '\xe02d' } text = mw.ustring.gsub(text, 'ñ', 'n') text = mw.ustring.gsub(text, 'þ', 's') text = mw.ustring.gsub(text, 'wilya', 'vilya') local out = {} for i=0, #letters do		if letters[i].name == text then if i > 0 then out.previous = letters[i-1].name else out.previous = '' end if i < #letters then out.next = letters[i+1].name else out.next = '' end end end return out end

return export