Module:ko-link
Appearance
- The following documentation is located at Module:ko-link/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
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