Mòdul:xib-trans

De Viccionari
Salta a: navegació, cerca
Icona de documentació de mòdul Documentació del mòdul[mostra] [modifica] [refresca]

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


Mòdul per a la transliteració d’alfabet llatí a escriptura ibèrica. Vegeu Viccionari:Escriptura ibèrica per a més informació. Vegeu Plantilla:xib-trans per a usar-lo directament.

local p = {}

local table_epigraphy = {
	["a1"] = "NE Iberian a1a.svg",
	["a101"] = "NE Iberian a1a.svg",
	["a102"] = "NE Iberian a1b.svg",
	["a103"] = "NE Iberian a1c.svg",
	["a2"] = "NE Iberian a2a.svg",
	["a201"] = "NE Iberian a2a.svg",
	["a202"] = "NE Iberian a2b.svg",
	["a3"] = "NE Iberian a3.svg",
	["a4"] = "NE Iberian r5.svg", -- equal to r5
	["a5"] = "NE Iberian a5a.svg",
	["a501"] = "NE Iberian a5a.svg",
	["a502"] = "NE Iberian a5b.svg",
	["a6"] = "NE Iberian a6a.svg",
	["a601"] = "NE Iberian a6a.svg",
	["a602"] = "NE Iberian a6b.svg",
	["a7"] = "NE Iberian a7.svg", -- equal to r4
	["ba1"] = "NE Iberian ba1.svg",
	--["ba2"] =
	--["ba3"] = 
	["ba4"] = "Greek Gamma pointed.svg",
	["ba401"] = "Greek Gamma pointed.svg",
	--["ba402"] = 
	["ba5"] = "NE Iberian ba5a.svg",
	["ba501"] = "NE Iberian ba5a.svg",
	--["ba502"] = 
	["be1"] = "NE Iberian be1.svg",
	["be2"] = "NE Iberian be2a.svg",
	["be201"] = "NE Iberian be2a.svg",
	["be202"] = "NE Iberian be2b.svg",
	["be3"] = "NE Iberian be3a.svg",
	["be301"] = "NE Iberian be3a.svg",
	["be302"] = "NE Iberian be3b.svg",
	["be4"] = "NE Iberian be4.svg",
	["be5"] = "NE Iberian be5.svg",
	["be6"] = "NE Iberian be6.svg",
	["be7"] = "NE Iberian be7a.svg",
	["be701"] = "NE Iberian be7a.svg",
	--["be702"] = 
	--["be703"] = 
	["be8"] = "NE Iberian be8a.svg",
	["be801"] = "NE Iberian be8a.svg",
	--["be802"] = 
	["be9"] = "NE Iberian be9.svg",
	["be10"] = "NE Iberian be10.svg",
	["be11"] = "NE Iberian be11.svg",
	["bi1"] = "NE Iberian bi1.svg",
	["bi2"] = "NE Iberian bi2.svg",
	["bi3"] = "NE Iberian bi3.svg",
	["bi4"] = "NE Iberian bi4.svg",
	["bi5"] = "NE Iberian bi5.svg",
	--["bi6"] = 
	--["bi7"] = 
	["bo1"] = "NE Iberian ta2.svg", -- renamed to ta2
	["bo2"] = "NE Iberian bo2.svg",
	["bo3"] = "NE Iberian ta3.svg", -- renamed to ta3
	["bo4"] = "NE Iberian bo4.svg",
	["bu1"] = "NE Iberian bu1.svg",
	["bu2"] = "NE Iberian bu2.svg",
	["e1"] = "NE Iberian e1.svg",
	["e2"] = "NE Iberian e2.svg",
	--["e3"] = 
	["e4"] = "NE Iberian e4.svg",
	--["e5"] = 
	--["e6"] =
	--["e601"] = 
	--["e602"] = 
	["e7"] = "Greek Digamma oblique.svg",
	["e8"] = "Greek Epsilon 04.svg",
	--["e9"] = 
	["e10"] = "Greek Epsilon 10.svg",
	["e1001"] = "Greek Epsilon 10.svg",
	--["e1002"] = 
	--["e11"] = 
	["i1"] = "NE Iberian i1a.svg",
	["i101"] = "NE Iberian i1a.svg",
	["i102"] = "NE Iberian i1b.svg",
	["i2"] = "NE Iberian i2.svg",
	["i3"] = "NE Iberian i3.svg",
	["i4"] = "NE Iberian i4.svg",
	["i5"] = "NE Iberian i5.svg",
	["i6"] = "NE Iberian i6.svg",
	--["i7"] = 
	["i8"] = "NE Iberian i8.svg",
	["ka1"] = "NE Iberian ka1.svg",
	["ka2"] = "NE Iberian ka2.svg",
	["ka3"] = "NE Iberian ka3.svg",
	["ka4"] = "NE Iberian ka4.svg",
	["ka5"] = "Greek Alpha 03.svg",
	["ka501"] = "Greek Alpha 03.svg",
	["ka502"] = "Greek Alpha 06.svg",
	["ka503"] = "Greek Alpha 09.svg",
	["ka6"] = "NE Iberian ka6.svg",
	--["ka7"] = 
	["ke1"] = "NE Iberian ke1.svg",
	["ke2"] = "NE Iberian ke2.svg",
	["ke3"] = "NE Iberian ke3.svg",
	["ke4"] = "NE Iberian ke4.svg",
	["ke5"] = "NE Iberian ke5.svg",
	["ke6"] = "NE Iberian ke6.svg",
	["ke7"] = "NE Iberian ke7.svg",
	["ke8"] = "NE Iberian ke8.svg",
	["ke9"] = "NE Iberian ke9.svg",
	["ke10"] = "NE Iberian ke10.svg",
	["ke11"] = "NE Iberian ke11.svg",
	["ke12"] = "NE Iberian ke12.svg",
	["ke13"] = "NE Iberian ke13.svg",
	["ke14"] = "NE Iberian ke14a.svg",
	["ke1401"] = "NE Iberian ke14a.svg",
	--["ke1402"] = 
	["ki1"] = "NE Iberian ki1.svg",
	--["ki2"] =
	--["ki201"] = 
	--["ki202"] = 
	["ki3"] = "NE Iberian ki3.svg",
	["ki4"] = "NE Iberian ki4.svg",
	["ki5"] = "NE Iberian ki5.svg",
	["ki6"] = "NE Iberian ki6.svg",
	["ki7"] = "NE Iberian ki7.svg",
	["ki8"] = "NE Iberian ki8.svg",
	["ki9"] = "NE Iberian ki9.svg",
	["ko1"] = "Greek Epsilon X-shaped.svg",
	--["ko2"] = 
	["ko3"] = "Greek Punct 06.svg",
	--["ko4"] = 
	["ku1"] = "Greek Theta 01.svg",
	["ku2"] = "Greek Omicron 06.svg",
	["ku3"] = "Greek Omicron 01.svg",
	["ku301"] = "Greek Omicron 01.svg",
	["ku302"] = "Greek Theta 09.svg",
	--["ku4"] = 
	["l1"] = "Greek Lambda normal.svg",
	["l2"] = "Greek Lambda Gamma-shaped.svg",
	["m1"] = "NE Iberian m1.svg",
	["ḿ1"] = "Greek Upsilon V-shaped.svg",
	["ḿ2"] = "Greek Upsilon normal.svg",
	--["ḿ3"] =
	--["ḿ301"] = 
	--["ḿ302"] = 
	["ḿ4"] = "Greek Upsilon Twig-shaped.svg",
	--["ḿ401"] = 
	["ḿ402"] = "Greek Upsilon Twig-shaped.svg",
	["ḿ5"] = "Greek Tau normal.svg",
	["ḿ501"] = "Greek Tau normal.svg",
	["ḿ502"] = "Greek Zeta archaic.svg",
	["n1"] = "Greek Nu 01.svg",
	["n101"] = "Greek Nu 01.svg",
	["n102"] = "Greek Nu 05.svg",
	["n2"] = "NE Iberian n2.svg",
	--["n3"] = 
	["o1"] = "NE Iberian o1.svg",
	["o2"] = "Greek Eta diagonal.svg",
	["o3"] = "Greek Heta 07.svg",
	["o4"] = "Greek Eta diagonal-2-bars.svg",
	["o401"] = "Greek Eta diagonal-2-bars.svg",
	["o402"] = "Greek Eta 2-bars.svg",
	["o5"] = "Greek Eta archaic.svg",
	--["o6"] = 
	--["o7"] = 
	["r1"] = "NE Iberian r1a.svg",
	["r101"] = "NE Iberian r1a.svg",
	["r102"] = "NE Iberian r1b.svg",
	["r2"] = "NE Iberian r2a.svg",
	["r201"] = "NE Iberian r2a.svg",
	["r202"] = "NE Iberian r2b.svg",
	["r3"] = "NE Iberian r3.svg",
	["r4"] = "NE Iberian a7.svg", -- equal to a7
	["r5"] = "NE Iberian r5.svg", -- equal to a4
	["r6"] = "NE Iberian a2a.svg", -- equal to a2
	--["ŕ1"] = 
	["ŕ3"] = "Greek Koppa 05.svg",
	--["ŕ4"] = 
	["ŕ5"] = "Greek Koppa normal.svg",
	["ŕ6"] = "Greek Koppa 04.svg",
	["ŕ7"] = "Greek Koppa strikethrough.svg",
	["ŕ8"] = "NE Iberian ŕ8.svg",
	--["ŕ9"] =
	--["ŕ901"] = 
	--["ŕ902"] = 
	["s1"] = "NE Iberian s1b.svg",
	["s101"] = "NE Iberian s1a.svg",
	["s102"] = "NE Iberian s1b.svg",
	["s2"] = "NE Iberian s2a.svg",
	["s201"] = "NE Iberian s2a.svg",
	["s202"] = "NE Iberian s2b.svg",
	["s3"] = "NE Iberian s3.svg",
	["s4"] = "NE Iberian s4a.svg",
	["s401"] = "NE Iberian s4a.svg",
	["s402"] = "NE Iberian s4b.svg",
	["s5"] = "NE Iberian s5.svg",
	["s6"] = "NE Iberian s6.svg",
	["s7"] = "NE Iberian s7.svg",
	["s8"] = "NE Iberian s8.svg",
	["s9"] = "NE Iberian s9.svg",
	["s10"] = "NE Iberian s10a.svg",
	["s1001"] = "NE Iberian s10a.svg",
	["s1002"] = "NE Iberian s10b.svg",
	["ś1"] = "NE Iberian ś1.svg",
	["ś2"] = "Greek Mu classical.svg",
	--["ś3"] = 
	["ta1"] = "NE Iberian ta1.svg",
	["ta2"] = "NE Iberian ta2.svg", -- former bo1
	["ta3"] = "NE Iberian ta3.svg", -- former bo3
	["te1"] = "NE Iberian te1.svg",
	--["te2"] = 
	--["te3"] = 
	["te4"] = "Greek Phi 08.svg",
	--["te5"] = 
	["te6"] = "Greek Theta 03.svg",
	["te7"] = "Greek Theta 02.svg",
	["te8"] = "NE Iberian te8.svg",
	["te9"] = "NE Iberian te9.svg",
	["te10"] = "NE Iberian te10.svg",
	["te11"] = "NE Iberian te11.svg",
	["te12"] = "NE Iberian te12.svg",
	["te13"] = "NE Iberian te13.svg",
	["te14"] = "NE Iberian te14.svg",
	["te15"] = "PhoenicianH-01.svg",
	["te16"] = "Greek Phi square.svg",
	["ti1"] = "NE Iberian ti1a.svg",
	["ti101"] = "NE Iberian ti1a.svg",
	["ti102"] = "NE Iberian ti1b.svg",
	["ti2"] = "NE Iberian ti2a.svg",
	["ti201"] = "NE Iberian ti2a.svg",
	["ti202"] = "NE Iberian ti2b.svg",
	["ti3"] = "NE Iberian ti3.svg",
	["ti4"] = "NE Iberian ti4.svg",
	["ti5"] = "NE Iberian ti5.svg",
	["ti6"] = "NE Iberian ti6.svg",
	["ti7"] = "NE Iberian ti7.svg",
	["ti8"] = "NE Iberian ti8.svg",
	["ti9"] = "NE Iberian ti9.svg",
	["to1"] = "NE Iberian to1.svg",
	["to2"] = "NE Iberian to2.svg",
	["to3"] = "NE Iberian to3.svg",
	["to4"] = "NE Iberian to4.svg",
	["tu1"] = "NE Iberian tu1.svg",
	["tu2"] = "NE Iberian tu2a.svg",
	["tu201"] = "NE Iberian tu2a.svg",
	["tu202"] = "NE Iberian tu2b.svg",
	["tu3"] = "NE Iberian tu3.svg",
	["tu4"] = "NE Iberian tu4.svg",
	["tu5"] = "NE Iberian tu5.svg",
	["tu6"] = "NE Iberian tu6.svg",
	["u1"] = "NE Iberian u1.svg",
	["u2"] = "NE Iberian u2.svg",
	["u3"] = "NE Iberian u3.svg",
	["u4"] = "NE Iberian u4.svg",
	["u5"] = "NE Iberian u5.svg",
	["p1"] = "Greek Punct 09.svg",
	["p2"] = "NE Iberian pun2.svg",
	["p3"] = "NE Iberian pun3.svg",
	["p4"] = "Greek Punct 12.svg",
	["p5"] = "Greek Punct 13.svg",
}

local table_no_dual = {
	["a"] = table_epigraphy["a201"],
	["e"] = table_epigraphy["e1"],
	["i"] = table_epigraphy["i2"],
	["o"] = table_epigraphy["o1"],
	["u"] = table_epigraphy["u3"],
	["ba"] = table_epigraphy["ba1"],
	["be"] = table_epigraphy["be1"],
	["bi"] = table_epigraphy["bi1"],
	["bo"] = table_epigraphy["bo2"],
	["bu"] = table_epigraphy["bu1"],
	["ka"] = table_epigraphy["ka1"],
	["ke"] = table_epigraphy["ke1"],
	["ki"] = table_epigraphy["ki1"],
	["ko"] = table_epigraphy["ko1"],
	["ku"] = table_epigraphy["ku1"],
	["ta"] = table_epigraphy["ta1"],
	["te"] = table_epigraphy["te1"],
	["ti"] = table_epigraphy["ti4"],
	["to"] = table_epigraphy["to2"],
	["tu"] = table_epigraphy["tu1"],
	["l"] = table_epigraphy["l1"],
	["m"] = table_epigraphy["m1"],
	["n"] = table_epigraphy["n2"],
	["ḿ"] = table_epigraphy["ḿ1"],
	["m̌" ]= table_epigraphy["ḿ501"],
	["r"] = table_epigraphy["r1"],
	["ŕ"] = table_epigraphy["ŕ3"],
	["s"] = table_epigraphy["s102"],
	["ś"] = table_epigraphy["ś1"],
	[" "] = table_epigraphy["p2"],
	["I"] = table_epigraphy["ba1"],
}

local table_dual = {
	["á"] = table_epigraphy["a3"],
	["a"] = table_epigraphy["a3"],
	["é"] = table_epigraphy["e4"],
	["e"] = table_epigraphy["e4"],
	["í"] = table_epigraphy["i3"],
	["i"] = table_epigraphy["i101"],
	["ó"] = table_epigraphy["o4"],
	["o"] = table_epigraphy["o3"],
	["ú"] = table_epigraphy["u5"],
	["u"] = table_epigraphy["u3"],
	["ba"] = table_epigraphy["ba1"],
	["be"] = table_epigraphy["be801"],
	["bi"] = table_epigraphy["bi3"],
	["bo"] = table_epigraphy["bo4"],
	["bu"] = table_epigraphy["bu2"],
	["ka"] = table_epigraphy["ka3"],
	["ga"] = table_epigraphy["ka2"],
	["ḱa"] = table_epigraphy["ka4"],
	["ke"] = table_epigraphy["ke8"],
	["ge"] = table_epigraphy["ke7"],
	["ḱe"] = table_epigraphy["ke11"],
	["ki"] = table_epigraphy["ki5"],
	["gi"] = table_epigraphy["ki1"],
	["ko"] = table_epigraphy["ko2"],
	["go"] = table_epigraphy["ko1"],
	["ku"] = table_epigraphy["ku2"],
	["gu"] = table_epigraphy["ŕ8"],
	["ta"] = table_epigraphy["ta3"],
	["da"] = table_epigraphy["ta1"],
	["te"] = table_epigraphy["te14"],
	["de"] = table_epigraphy["te8"],
	["ti"] = table_epigraphy["ti7"],
	["di"] = table_epigraphy["ti101"],
	["to"] = table_epigraphy["to3"],
	["do"] = table_epigraphy["to1"],
	["tu"] = table_epigraphy["tu201"],
	["du"] = table_epigraphy["tu1"],
	["l"] = table_epigraphy["l2"],
	["â"] = table_epigraphy["e7"],
	["m"] = table_epigraphy["m1"],
	["n"] = table_epigraphy["n101"],
	["ḿ"] = table_epigraphy["ḿ402"],
	["m̌" ] = table_epigraphy["ḿ502"],
	["r"] = table_epigraphy["r5"],
	["ř"] = table_epigraphy["ŕ5"],
	["ŕ"] = table_epigraphy["ŕ7"],
	["ŝ"] = table_epigraphy["s6"],
	["s"] = table_epigraphy["s8"],
	["ś"] = table_epigraphy["ś1"],
	[" "] = table_epigraphy["p3"],
	["I"] = table_epigraphy["ba1"],
}

function p.tr(text, dual, dim)
	if type(text) == "table" then
		local args = text:getParent().args
		text = args[1]
		dual = args[2]
		dim = args.dim
	end
	
	if dual == nil and mw.ustring.find(text, "[áéíóúgḱdâřŝ]") then
		dual = "dual"
	end
	
	if dim == nil then
		dim = "x20px"
	elseif tonumber(dim) then
		dim = "x" .. dim .. "px"
	end
	
	local table_tr
	if mw.ustring.find(text, "[123456789]") ~= nil then
		table_tr = table_epigraphy
	elseif dual == "dual" then
		table_tr = table_dual
	else
		table_tr = table_no_dual
	end
	
	local syllabic = {["b"] = true, ["k"] = true, ["g"] = true, ["t"] = true, ["d"] = true}
	
	local sign = ''
	local tr = {}
	for i = 1, mw.ustring.len(text) do
		local letter = mw.ustring.sub(text, i, i)
		if letter ~= "-" then -- no sign for afixes mark
			sign = sign .. letter
			if not (tonumber(mw.ustring.sub(text, i+1, i+1)) or syllabic[letter]) then
				if not table_tr[sign] then
					do return end
				else
					tr[#tr+1] = "[[File:" .. table_tr[sign] .. "|" .. dim .. "|" .. sign .. "]]"
					sign = ''
				end
			end
		end
	end
	
	return table.concat(tr)
end

return p