Module:mg-spel: Difference between revisions

From Linguifex
Jump to navigation Jump to search
(Created page with "local export = {} function export.alter(frame) local ret = {} return table.concat(ret) end return export")
 
No edit summary
Line 1: Line 1:
local PAGENAME = mw.title.getCurrentTitle().text
local gsub = mw.ustring.gsub
local lang = require("Module:languages").getByCode("cel-gal")
local m_l = require('Module:links')
local m_q = require('Module:qualifier')
local export = {}
local export = {}


function export.alter(frame)
function export.alter(frame)
local ret = {}
local ret = {}
local term = PAGENAME or frame:getParent().args[1]
local e, a, c, s1 = term, term, term, 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")
local ea_q = {}
if e ~= term and a ~= term then
if e == a then
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish script", "Asturian script"}))
else
table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish script"}))
table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier({"Asturian script"}))
end
end
-- Celtic
c = c:gsub("c([aou])", "k%1")
c = c:gsub("qu([ei])", "k%1")
c = c:gsub("ñ", "in")
c = c:gsub("x", "is")
-- Southern
s = s:gsub("ñ", "nh")
s = s:gsub("il", "lh")
return table.concat(ret)
return table.concat(ret)

Revision as of 19:58, 23 August 2021


Implements {{mg-mut}} and {{mg-alter}}.
local PAGENAME = mw.title.getCurrentTitle().text
local gsub = mw.ustring.gsub

local lang = require("Module:languages").getByCode("cel-gal")
local m_l = require('Module:links')
local m_q = require('Module:qualifier')

local export = {}

function export.alter(frame)
	local ret = {}
	local term = PAGENAME or frame:getParent().args[1]
	
	local e, a, c, s1 = term, term, term, 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")
	
	local ea_q = {}
	if e ~= term and a ~= term then
		if e == a then
			table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish script", "Asturian script"}))
		else
			table.insert(ret, "* " .. m_l.full_link({term = e, lang = lang}) .. " " .. m_q.format_qualifier({"Spanish script"}))
			table.insert(ret, "* " .. m_l.full_link({term = a, lang = lang}) .. " " .. m_q.format_qualifier({"Asturian script"}))
		end
	end
		
	-- Celtic
	c = c:gsub("c([aou])", "k%1")
	c = c:gsub("qu([ei])", "k%1")
	c = c:gsub("ñ", "in")
	c = c:gsub("x", "is")
	
	-- Southern
	s = s:gsub("ñ", "nh")
	s = s:gsub("il", "lh")
	
	return table.concat(ret)
end


return export