Module:links/templates: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local exports = {} local m_links = require("Module:links") local m_languages = require("Module:languages") local m_parameters = require("Module:parameters") local params = { [1] = {required = true}, [2] = {required = true}, [3] = {alias_of = "alt"}, ["alt"] = {}, [4] = {alias_of = "text"}, ["t"] = {alias_of = "text"}, ["text"] = {}, } local function get_data(frame) local args = m_parameters.process(frame:getParent(), params) return { term = args[1], langu...") |
No edit summary |
||
Line 1: | Line 1: | ||
local | local export = {} | ||
local m_links = require("Module:links") | local m_links = require("Module:links") | ||
Line 39: | Line 39: | ||
end | end | ||
return | return export |
Revision as of 14:15, 6 August 2023
Documentation for this module may be created at Module:links/templates/documentation
local export = {}
local m_links = require("Module:links")
local m_languages = require("Module:languages")
local m_parameters = require("Module:parameters")
local params = {
[1] = {required = true},
[2] = {required = true},
[3] = {alias_of = "alt"},
["alt"] = {},
[4] = {alias_of = "text"},
["t"] = {alias_of = "text"},
["text"] = {},
}
local function get_data(frame)
local args = m_parameters.process(frame:getParent(), params)
return {
term = args[1],
language = m_languages.get_by_code(args[2]),
alt = args["alt"],
gloss = args["text"],
}
end
function export.link(frame)
return m_links.full_link(get_data(frame))
end
function export.mention(frame)
return m_links.full_link(get_data(frame), "term")
end
function export.mention_with_language_name(frame)
local data = get_data(frame)
data["showlanguage"] = true
return m_links.full_link(data, "term")
end
return export