Module:mg-spel: Difference between revisions
Jump to navigation
Jump to search
Implements
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
local e = term; local a = term; local c = term; local s = term | local e = term; local a = term; local c = term; local s = term | ||
-- Spanish | -- Spanish | ||
Line 30: | Line 31: | ||
s = s:gsub("il", "lh") | s = s:gsub("il", "lh") | ||
s = s:gsub("v", "b") | s = s:gsub("v", "b") | ||
local lh = match(s, "lh") | |||
-- Celtic | -- Celtic | ||
Line 46: | Line 48: | ||
table.insert(qs, "Asturian") | table.insert(qs, "Asturian") | ||
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier(qs) .. "\n") | table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier(qs) .. "\n") | ||
table.insert(ret, "* " .. m_l.full_link({term = s, lang = lang}) .. " " .. m_q.format_qualifier({"Southern"}) .. "\n") | table.insert(ret, "* " .. m_l.full_link({term = s, lang = lang}) | ||
.. (lh and ", " .. m_l.full_link({term = s:gsub("lh", "j"), lang = lang}) or "") | |||
.. " " .. m_q.format_qualifier({"Southern"}) .. "\n") | |||
elseif e == s then | elseif e == s then | ||
table.insert(qs, "Spanish") | table.insert(qs, "Spanish") | ||
Line 60: | Line 64: | ||
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish"}) .. "\n") | table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish"}) .. "\n") | ||
table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier({"Asturian"}) .. "\n") | table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier({"Asturian"}) .. "\n") | ||
table.insert(ret, "* " .. m_l.full_link({term = s, lang = lang}) .. " " .. m_q.format_qualifier({"Southern"}) .. "\n") | table.insert(ret, "* " .. m_l.full_link({term = s, lang = lang}) | ||
.. (lh and ", " .. m_l.full_link({term = s:gsub("lh", "j"), lang = lang}) or "") | |||
.. " " .. m_q.format_qualifier({"Southern"}) .. "\n") | |||
end | end | ||
if c ~= term then | if c ~= term then | ||
table.insert(ret, "* " .. m_l.full_link({term = c, lang = lang}) | table.insert(ret, "* " .. m_l.full_link({term = c, lang = lang}) .. " " .. m_q.format_qualifier({"Celtic"}) .. "\n") | ||
end | end | ||
Revision as of 14:45, 25 August 2021
- The following documentation is located at Module:mg-spel/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
Implements
{{mg-mut}}
and {{mg-alter}}
.
local PAGENAME = mw.title.getCurrentTitle().text
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local lang = require("Module:languages").getByCode("cel-gal")
local m_l = require('Module:links')
local m_q = require('Module:qualifier')
local abbr = {"Spanish", "Asturian", "Celtic", "Southern"}
local export = {}
function export.alter(frame)
local ret = {}; local qs = {}
local term = frame:getParent().args[1] or PAGENAME
local e = term; local a = term; local c = term; local s = term
-- Spanish
e = e:gsub("il", "ll")
e = e:gsub("v", "b")
e = e:gsub("[gh]", "j")
-- Asturian
a = a:gsub("il", "ll")
a = a:gsub("v", "b")
-- Southern
s = s:gsub("ñ", "nh")
s = s:gsub("il", "lh")
s = s:gsub("v", "b")
local lh = match(s, "lh")
-- Celtic
c = c:gsub("c([aou])", "k%1")
c = c:gsub("qu([ei])", "k%1")
c = c:gsub("ñ", "in")
c = c:gsub("x", "is")
-- disclaimer: awful approach below, your physical and mental integrity may be at risk
if e == a and a == s then
qs = {"Spanish", "Asturian", "Southern"}
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier(qs) .. "\n")
elseif e == a then
table.insert(qs, "Spanish")
table.insert(qs, "Asturian")
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier(qs) .. "\n")
table.insert(ret, "* " .. m_l.full_link({term = s, lang = lang})
.. (lh and ", " .. m_l.full_link({term = s:gsub("lh", "j"), lang = lang}) or "")
.. " " .. m_q.format_qualifier({"Southern"}) .. "\n")
elseif e == s then
table.insert(qs, "Spanish")
table.insert(qs, "Southern")
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier(qs) .. "\n")
table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier({"Asturian"}) .. "\n")
elseif a == s then
table.insert(qs, "Asturian")
table.insert(qs, "Southern")
table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier(qs) .. "\n")
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish"}) .. "\n")
else
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish"}) .. "\n")
table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier({"Asturian"}) .. "\n")
table.insert(ret, "* " .. m_l.full_link({term = s, lang = lang})
.. (lh and ", " .. m_l.full_link({term = s:gsub("lh", "j"), lang = lang}) or "")
.. " " .. m_q.format_qualifier({"Southern"}) .. "\n")
end
if c ~= term then
table.insert(ret, "* " .. m_l.full_link({term = c, lang = lang}) .. " " .. m_q.format_qualifier({"Celtic"}) .. "\n")
end
if e == term and a == term and c == term and s == term then
error('Delete me')
end
return table.concat(ret)
end
return export