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

local export = {}

-- Language-tags any bare links. Used in [[Wiktionary:Frequency lists/Korean 5800]].
function export.link(frame)
	local text = frame.args[1]
	
	if not text then
		return nil
	end
	
	local function link(text)
		return '<span class="Kore" lang="ko">[['
			.. text
			.. '#Korean|' .. text .. ']]</span>'
	end
	
	local function tag(text)
		return '<span class="Kore" lang="ko">' .. text .. '</span>'
	end
	
	return (text
		:gsub(
			"%[%[([^%]]+)%]%]",
			link)
		:gsub( -- Korean words inside parentheses
			"%(([^)]+)%)",
			function (text)
				return "(" .. tag(text) .. ")"
			end))
end

return export