Module:CodeCat/links

There are no reviewed versions of this page, so it may not have been checked for adherence to standards.

Documentation for this module may be created at Module:CodeCat/links/doc

-- a library of functions for en.Wiktionary to replace templates
local lang = require("Module:CodeCat/lang")
local script = require("Module:CodeCat/script")

local m = {}

function link(page, display, langcode)
    local l = lang[langcode]
    assert(l ~= nil, "\"" .. langcode .. "\" is not a language code.")
    return script[l.script].wrap("[[" .. page .. "#" .. l.name .. "|" .. display .. "]]", langcode)
end

function m.link(frame)
    return link(frame.args[2], frame.args[3], frame.args[1])
end

return m