Module:inc-extension

From Wiktionary, the free dictionary
Jump to navigation Jump to search


local export = {}

local m_links = require("Module:links")

local m_lang_inc_ash = require("Module:languages").getByCode('inc-ash')

function export.show(frame)
	local args = frame:getParent().args
	local lang = args[1] or 'und'
	local m_lang = require("Module:languages").getByCode(lang)
	
	local res = ""
	for i, suffix in ipairs(args) do
		if i ~= 1 then
			local word = frame:expandTemplate{title = 'chars', args = {'pra', suffix}}
			word = '-' .. word .. '-'
			if i ~= 2 or not args['noplus'] then res = res .. ' + ' end
			if i == 2 then if not args['notext'] then res = res .. ' [[w:Middle Indo-Aryan languages|Middle Indo-Aryan]] ' end end
			res = res .. m_links.full_link({lang = m_lang_inc_ash, term = word}, "term")
			if not args['nocat'] then res = res .. '[[Category:' .. m_lang:getCanonicalName() .. ' terms extended with Indo-Aryan ' .. word .. ']]' end
		end
	end
	
	return res
end

return export