local m_links = require("Module:User:Isomorphyc/links-draft")
local export = {}
-- Used in ] and ]
function export.l_term_t(frame)
local face = frame.args
local allowSelfLink = frame.args; allowSelfLink = not allowSelfLink or allowSelfLink == ""
local params = {
= {required = true},
= {},
= {},
= {alias_of = "gloss"},
= {list = true},
= {},
= {},
= {},
= {},
= {alias_of = "gloss"},
= {},
= {},
= {},
}
-- Compatibility mode for {{term}}.
-- If given a nonempty value, the function uses lang= to specify the
-- language, and all the positional parameters shift one number lower.
local compat = (frame.args or "") ~= ""
if compat then
params = {},
table.remove(params, 1)
end
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = args
-- Tracking for missing language or und
if not lang then
require("Module:debug").track("link/no lang")
elseif lang == "und" then
require("Module:debug").track("link/und")
end
lang = lang or "und"
local sc = args
local term = args
local alt = args
-- Check parameters
lang = require("Module:User:Isomorphyc/languages-draft").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
if not term and not alt and frame.args then
term = frame.args
end
-- Forward the information to full_link
return m_links.full_link({lang = lang, sc = sc, term = term, alt = alt, id = args, tr = args, pr = args, genders = args, gloss = args, pos = args, lit = args}, face, allowSelfLink)
end
function export.ll(frame)
local args = frame:getParent().args
local allowSelfLink = args; allowSelfLink = not allowSelfLink or allowSelfLink == ""
local lang = args
lang = require("Module:User:Isomorphyc/languages-draft").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
local text = args
local alt = args
if text == "" then return alt or "" end
if alt == "" then alt = nil end
local id = args; if id == "" then id = nil end
return m_links.language_link(text, alt, lang, id, allowSelfLink)
end
function export.def_t(frame)
local params = {
= {required = true, default = ""},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
return m_links.english_links(args)
end
return export