Module:Stitchete

Èn årtike di Wiccionaire.
Sauter à la navigation Sauter à la recherche
I gn a nén co di dzo-pådje /doc pol notule d' esplikêyes. Clitchîz cial po l' ahiver.
local p = {}
local builder = require("Module:Builder"); 
local language = require("Module:Lingaedje");

local _affixes = {
	caw	= "cawete",
	bet	= "betchete", 
	ris	= "ristitchete"
}
local _grammars = {
	a 	= "addjectifs",
	adv = "adviebes", 
	c	= "codjowas", 
	npl	= "nos d' plaece", 
	ndj	= "nos d' djins",
	np = "nos prôpes",
	pn = "prezintoes-nombes",
	p	= "pårticipes erireces",
	pp = "pårticipes prezintreces",
	s	= "sustantifs", 
	v	= "viebes",
	v1	= "viebes del prumire troke",
	v2	= "viebes del deujhinme troke",
	v3	= "viebes del troejhinme troke",
	v4	= "viebes del cwatrinme troke",
	v5	= "viebes del cénkinme troke"
}
local _long = {[2]="dobe", [3]="tripe"}

function render (afftyp, affix, gram, lang, ritch, long, anchor, di, fwaitso, rif)
		
	local out = ""
	local cat = "avou l' "
	local di_ = "di"
	local fwaitso_ = ""
	
	gram = mw.text.trim(gram)
	afftyp = _affixes[afftyp]
	long = tonumber(long)
	
	-- (-)affix(-)
	if afftyp == _affixes["caw"] then
		affix =  "-" .. affix 
	elseif afftyp == _affixes["bet"] then
		affix =  affix .. "-"
		if di and (di == "rafoircixhaedje" or di == "rfoircixhaedje") then
			afftyp = "rafoircixhante " .. afftyp
			di = ""
		end
	elseif afftyp == _affixes["ris"] then
		affix =  "-" .. affix .. "-"
	end
	
	-- dobe/tripe cawete
	if _long[long] then
		cat = cat .. _long[long] .. " "
		local cat_long_word = "avou ene " .. _long[long] .. " " ..afftyp
		builder.add_category( language.grammar({args={"Mots", lang, cat_long_word, vowel="1"}}), 0)
	end


	
	cat = cat ..  afftyp .. " " .. affix

	if di and di ~="" then
		if mw.ustring.match( di, "^[aåeéêiîoôuû]") then	di_ = "d'"	end
		cat = table.concat({cat, di_, di}," ")
	end

	if rif and rif ~="" then
		if afftyp == _affixes["caw"] then
			rif =  "-" .. rif
		elseif afftyp == _affixes["bet"] then
			rif =  rif .. "-"
		elseif afftyp == _affixes["ris"] then
			rif =  "-" .. rif .. "-"
		end
		cat = table.concat({cat, " (", rif, ")"},"")
	end
	
	if fwaitso and fwaitso ~="" then
		if fwaitso == "a" then
			fwaitso_ = "èn addjectif"
		elseif fwaitso == "s" or fwaitso == "n" then
			fwaitso_ = "on no"
		elseif fwaitso == "v" then
			fwaitso_ = "on viebe"
		end
		cat = table.concat({cat, "acawêye a", fwaitso_}," ")
	end

	if anchor and anchor ~="" then
		affix = affix.."#"..anchor.."|"..affix
	end 
	
	if ritch ~= "0" then
		out = "l’ "
		
		-- dobe/tripe cawete
		if _long[long] then
			afftyp = _long[long] .. " " .. afftyp
		end
		
		-- di codjowaedje (viebe or codjowa(s)) avou cawete
		-- v+p+... ???
		if afftyp == _affixes["caw"] and gram == "v" or gram == "c" then
			afftyp = afftyp .. " di codjowaedje"
		end
		if afftyp == _affixes["caw"] and gram:sub(1,1) == "v" then
			afftyp = afftyp .. " d’ infinitif"
		end

		out = out .. "[[Wiccionaire:Cawetes et betchetes|"..afftyp.."]] « [[".. affix .."]] »"
		if di and di ~="" then
			if di_ == "d'" then
				out = out .. " d’ " .. di
			else
				out = out .. " di " .. di
			end
		end 

		if ritch ~= "1" then
			out = "avou ".. out
			if gram == "npl" or gram =="ndj" then
				out = out .. " des " .. _grammars[gram]
			end
			if gram:sub(1,1) == "v" then
				out = out .. " des " .. _grammars[gram]
			end

			-- "rif"
			if rif and rif ~="" then
				if lang == "wa-fel" then
					out = out .. " (disfondowe di « [[".. rif .."]] » )"
				else
					out = out .. " (e rfondou « [[".. rif .."]] » )"
				end
			end
			-- "fwaitso"
			if (fwaitso == "s" or fwaitso == "n") and gram == "s" then
				out = out .. " (des sustantifs fwaits so des nos)"
			elseif fwaitso == "v" and gram == "s" then
				out = out .. " (des sustantifs fwaits so des viebes)"
			end

		end
	else
		out = "[[".. affix .."]]"
	end
	
	if gram ~= "" then
		local grams = mw.text.split(gram, "+", true)
		for k,g in ipairs(grams) do	
			if _grammars[g] then
				builder.add_category( language.grammar({args={_grammars[g], lang, cat}}), 0)
			else
				builder.error("li croejhete « ".. g .." » n' est nén rkinoxhowe")
			end
		end
	else
		builder.add_category( language.grammar({args={"Mots", lang, cat, vowel="1"}}), 0)
	end

	-- some special extra categories
	if lang == "wa" then
		if affix == "-reye" then
			builder.add_category( language.grammar({args={"Mots", lang, "avou l' betchfessî ey"}}), 0)
		end
	end
		
	builder.add_content(out)	
end

function p.init(frame)	
	local args = frame.args
	local afftip, affix, gram, lang, anchor, di, fwaitso, rif = nil
	builder.init(frame, "Årtikes avou ene flotche dins ene stitchete")
		
	if args[1] then afftyp = args[1] end
	if args[2] then affix = args[2] end
	if args[3] then gram = args[3] end
	if args[4] then lang = args[4] end
	if args.ritch then ritch = args.ritch end
	if args.long then long = args.long end
	if args.anke then anchor = args.anke end
	if args.di then di = args.di end
	if args.fwaitso then fwaitso = args.fwaitso end
	if args.rif then rif = args.rif end
	
	if not args[1] then
		builder.error("li stitchete est vude")
	elseif not _affixes[afftyp] then
		builder.error("li stitchete n' est nén rkinoxhowe")
	else
		render(afftyp, affix, gram, lang, ritch, long, anchor, di, fwaitso, rif)
	end
	
	return builder.get_content()
end

return p