Bước tới nội dung

Mô đun:qualifier

Từ điển mở Wiktionary
local export = {}

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

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

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

return export