Module:mg-spel: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 5: Line 5:
local m_l = require('Module:links')
local m_l = require('Module:links')
local m_q = require('Module:qualifier')
local m_q = require('Module:qualifier')
local abbr = {"Spanish", "Asturian", "Celtic", "Southern"}


local export = {}
local export = {}


function export.alter(frame)
function export.alter(frame)
local ret = {}
local ret = {}; local qs = {}
local term = frame:getParent().args[1] or PAGENAME
local term = frame:getParent().args[1] or PAGENAME
Line 28: Line 30:
s = s:gsub("v", "b")
s = s:gsub("v", "b")
local list = {}
if e ~= term and a ~= term and s ~= term then
if s == e and s ~= a then
table.insert(list, "Spanish script")
table.insert(list, "Southern script")
elseif s == a and s ~= e then
table.insert(list, "Asturian script")
table.insert(list, "Southern script")
elseif e == a and s ~= e then
table.insert(list, "Spanish script")
table.insert(list, "Asturian script")
elseif s == e and s == a then
table.insert(list, "Spanish script")
table.insert(list, "Asturian script")
table.insert(list, "Southern script")
else
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish script"}) .. "\n")
table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier({"Asturian script"}) .. "\n")
table.insert(ret, "* " .. m_l.full_link({term = s, lang = lang}) .. " " .. m_q.format_qualifier({"Southern script"}) .. "\n")
end
if list then
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier(list) .. "\n")
end
end
-- Celtic
-- Celtic
c = c:gsub("c([aou])", "k%1")
c = c:gsub("c([aou])", "k%1")
Line 60: Line 36:
c = c:gsub("x", "is")
c = c:gsub("x", "is")
if c ~= term then
local list = {e, a, c, s}
table.insert(ret, "* " .. m_l.full_link({term = c, lang = lang}) .. " " .. m_q.format_qualifier({"Celtic script"}) .. "\n")
for i = 1, 4 do
for j = 1, 4 do
if list[i] == list[j] then
table.insert(qs, abbr[i])
end
end
if list[i] ~= term then
table.insert(ret, "* " .. m_l.full_link({term = list[i], lang = lang}) .. " " .. m_q.format_qualifier(qs or {abbr[i]}) .. "\n")
end
end
end