Pāriet uz saturu

Modulis:Taksosaite

Permanently protected module
Vikipēdijas lapa
Dokumentācijas ikona Moduļa dokumentācija[izveidot]
local p = {}
local getArgs = require('Module:Arguments').getArgs

function makeLink(link, text, parenthesis)
	
	if parenthesis then
		result = "''[[" .. link .. "|" .. text .. "]]''"
	else
		result = "[[" .. link .. "|" .. text .. "]]"
	end
	
	return result
end

function p._main(args)
	
	local latin = args[1]
	local latvian = args[2]
	local article = args[3]
	local bold = args[4]
	
	if article then
		link = article
	elseif latvian then
		link = latvian
	elseif latin then
		link = latin
	end
	
	if latvian then
		text = latvian
	elseif latin then
		text = latin
		parenthesis = true
	end
	
	result = makeLink(link,text,parenthesis)
	
	if bold == "b" then
		result = '<span style="font-weight:bold;">' .. result .. '</span>'
	end
	
	if latin and latvian then
		result = result .. " (''" .. latin .. "'')"
	end
	
	return result
end

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

return p