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"] =
	--["a101"] =
	--["a102"] = 
	--["a103"] = 
	["a2"] = "Greek Delta vertical.svg",
	["a201"] = "Greek Delta vertical.svg",
	--["a202"] = 
	["a3"] = "Greek Rho normal.svg",
	["a4"] = "Greek Delta 03.svg",
	--["a5"] =
	--["a501"] = 
	--["a502"] = 
	--["a6"] =
	--["a601"] = 
	--["a602"] = 
	--["a7"] = 
	["ba1"] = "NE Iberian ba1.svg",
	--["ba2"] =
	--["ba3"] = 
	["ba4"] = "Greek Gamma pointed.svg",
	["ba401"] = "Greek Gamma pointed.svg",
	--["ba402"] = 
	["ba5"] = "Greek Omega 04.svg",
	["ba501"] = "Greek Omega 04.svg",
	--["ba502"] = 
	["be1"] = "NE Iberian be1.svg",
	["be2"] = "Greek Omega 03.svg",
	--["be201"] = 
	["be202"] = "Greek Omega 03.svg",
	--["be3"] =
	--["be301"] = 
	--["be302"] = 
	--["be4"] =
	--["be401"] = 
	--["be402"] = 
	--["be5"] =
	--["be6"] = 
	--["be7"] =
	--["be701"] = 
	--["be702"] = 
	--["be703"] = 
	--["be8"] =
	--["be801"] = 
	--["be802"] = 
	--["be9"] = 
	--["be10"] = 
	--["be11"] = 
	["bi1"] = "NE Iberian bi1.svg",
	--["bi2"] = 
	--["bi3"] = 
	--["bi4"] = 
	--["bi5"] = 
	--["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"] = 
	["i2"] = "NE Iberian i2.svg",
	--["i3"] = 
	--["i4"] = 
	--["i5"] = 
	--["i6"] = 
	--["i7"] = 
	--["i8"] = 
	["ka1"] = "NE Iberian ka1.svg",
	["ka2"] = "NE Iberian ka2.svg",
	--["ka3"] =
	--["ka4"] = 
	["ka5"] = "Greek Alpha 03.svg",
	["ka501"] = "Greek Alpha 03.svg",
	["ka502"] = "Greek Alpha 06.svg",
	["ka503"] = "Greek Alpha 09.svg",
	["ka6"] = "Greek Lambda classical.svg",
	--["ka7"] = 
	["ke1"] = "Greek Gamma 08.svg",
	--["ke2"] = 
	--["ke3"] = 
	--["ke4"] = 
	--["ke5"] = 
	--["ke6"] = 
	["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"] = "Brahmi e.svg",
	["r101"] = "Brahmi e.svg",
	--["r102"] = 
	["r2"] = "Phoenician res.svg",
	["r201"] = "Phoenician res.svg",
	--["r202"] = 
	--["r3"] = 
	["r4"] = "Greek Koppa 06.svg",
	["r5"] = "Greek Delta 03.svg", -- equal to a4
	["r6"] = "Greek Delta 06.svg",
	--["ŕ1"] = 
	["ŕ3"] = "Greek Koppa 05.svg",
	--["ŕ4"] = 
	["ŕ5"] = "Greek Koppa normal.svg",
	["ŕ6"] = "Greek Koppa 04.svg",
	["ŕ7"] = "Greek Koppa strikethrough.svg",
	["ŕ8"] = "Greek Omicron 04.svg",
	--["ŕ9"] =
	--["ŕ901"] = 
	--["ŕ902"] = 
	["s1"] = "Greek Sigma Z-shaped.svg",
	--["s101"] = 
	["s102"] = "Greek Sigma Z-shaped.svg",
	--["s2"] =
	--["s201"] = 
	--["s202"] = 
	["s3"] = "Greek Iota Sigma-shaped.svg",
	--["s4"] =
	--["s401"] = 
	--["s402"] = 
	["s5"] = "Greek Sigma 12.svg",
	["s6"] = "Greek Iota 04.svg",
	["s7"] = "Greek Sigma 18.svg",
	["s8"] = "Greek Iota 05.svg",
	--["s9"] = 
	--["s10"] =
	--["s1001"] = 
	--["s1002"] = 
	["ś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"] = 
	--["te9"] = 
	--["te10"] = 
	["te11"] = "Greek Phi 03.svg",
	--["te12"] = 
	["te13"] = "Greek Theta archaic.svg",
	["te14"] = "Greek Theta archaic straight.svg",
	["te15"] = "PhoenicianH-01.svg",
	["te16"] = "Greek Phi square.svg",
	["ti1"] = "Greek Sampi Pamphylian.svg",
	["ti101"] = "Greek Sampi Pamphylian.svg",
	--["ti102"] = 
	--["ti2"] =
	--["ti201"] = 
	--["ti202"] = 
	--["ti3"] = 
	["ti4"] = "Greek Psi straight.svg",
	--["ti5"] = 
	--["ti6"] = 
	--["ti7"] = 
	--["ti8"] = 
	--["ti9"] = 
	["to1"] = "NE Iberian to1.svg",
	["to2"] = "Greek Psi V-shaped.svg",
	--["to3"] = 
	--["to4"] = 
	["tu1"] = "Greek Delta 05.svg",
	--["tu2"] =
	--["tu201"] = 
	--["tu202"] = 
	--["tu3"] = 
	--["tu4"] = 
	--["tu5"] = 
	--["u1"] = 
	--["u2"] = 
	["u3"] = "Greek Sampi pointed.svg",
	--["u4"] = 
	--["u5"] = 
	["p1"] = "Greek Punct 09.svg",
	["p2"] = "Greek Punct 10.svg",
	["p3"] = "Greek Punct 11.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"],
}

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"],
}

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
					if sign ~= "*" then
						require('Mòdul:utilitats').track("xib-trans")
					end
					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