Aller au contenu

Module:qualifier

Avy amin'i Wikibolana — Rakibolana malagasy malalaka

La documentation pour ce module peut être créée à Module:qualifier/doc

local export = {}

local concat = table.concat
local format_qualifier
local type = type

function export.format_qualifier(list, open, close, opencontent, closecontent)
	if type(list) ~= "table" then
		list = {list}
	end
	
	if #list == 0 then
		return ""
	end
	
	return "<span class=\"ib-brac qualifier-brac\">" .. (open or "(") .. "</span>" ..
	       (opencontent or "") ..
	       "<span class=\"ib-content qualifier-content\">" ..
	       concat(list, "<span class=\"ib-comma qualifier-comma\">,</span> ") ..
		   "</span>" ..
		   (closecontent or "") ..
		   "<span class=\"ib-brac qualifier-brac\">" .. (close or ")") .. "</span>"
end
format_qualifier = export.format_qualifier

function format_qualifier_with_clarification(list, clarification, open, close)
	opencontent = "<span class=\"qualifier-clarification\">" .. clarification .. "</span>" .. 
		"<span class=\"qualifier-clarification qualifier-quote\">" .. (open or "“") .. "</span>"
		
	closecontent = "<span class=\"qualifier-clarification qualifier-quote\">" .. (close or "”") .. "</span>"
			      
	return format_qualifier(list, "(", ")", opencontent, closecontent)
end

function export.sense(list)
	return format_qualifier(list) .. "<span class=\"ib-colon sense-qualifier-colon\">:</span>"
end

function export.antsense(list)
	return format_qualifier_with_clarification(list, "antonym(s) of ") .. "<span class=\"ib-colon sense-qualifier-colon\">:</span>"
end

return export