Module:nn-inf

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

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local lang = require("Module:languages").getByCode("nn")
local links = require("Module:links")

local export = {}

function export.main(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	
	local root = ''
	local separator = ''
	
	if args[1] and args[1] ~= '' then 
		root = args[1]
	else
		root = PAGENAME:gsub('[ae]$', '')
	end
	
	if args[2] and args[2] ~= '' then 
		separator = args[2]
	else
		separator = ','
	end
	
	if separator == ',' then
		separator = ', '
	end

	local linkA = links.full_link{term = root .. 'a', lang = lang}
	local linkE = links.full_link{term = root .. 'e', lang = lang}

	return  linkA .. separator .. linkE
end

return export