A modult a Modul:0links/templates/doc lapon tudod dokumentálni
local export = {}
--[=[
Modules used:
]
]
]
]
]
]=]
-- Used in ] and ].
function export.l_term_t(frame)
local m_debug = require("Module:0debug")
local m_params_data = mw.loadData("Module:0parameters/data")
local face = frame.args
local allowSelfLink = frame.args; allowSelfLink = not allowSelfLink or allowSelfLink == ""
local params = m_params_data.l_term_t
-- 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 = m_params_data.l_term_t_compat
end
local args = require("Module:0parameters").process(frame:getParent().args, params)
local lang = args
-- Tracking for missing language or und
if not lang then
m_debug.track("link/no lang")
elseif lang == "und" then
m_debug.track("link/und")
end
lang = lang or "und"
local sc = args
local term = args
local alt = args
if term == "" then term = nil end
lang = require("Module:0languages").getByCode(lang, 1, true)
sc = sc and require("Module:0scripts").getByCode(sc, "sc") or lang:findBestScript(alt or term)
-- Forward the information to full_link
return require("Module:0links").full_link(
{
lang = lang,
sc = sc,
term = term,
alt = alt,
gloss = args,
id = args,
tr = args,
ts = args,
genders = args,
pos = args,
lit = args,
accel = args and {
form = args,
translit = args,
lemma = args,
lemma_translit = args,
gender = args,
nostore = args,
} or nil,
},
face,
allowSelfLink
)
end
-- Used in ].
function export.ll(frame)
local args = require("Module:0parameters").process(frame:getParent().args, mw.loadData("Module:0parameters/data").ll)
local allowSelfLink = not args
local lang = args
local sc = args
local term = args
local alt = args
if term == "" then term = nil end
lang = require("Module:0languages").getByCode(lang, 1, true)
sc = sc and require("Module:0scripts").getByCode(sc, "sc") or lang:findBestScript(alt or term)
local id = args
term = require("Module:0links").language_link(
{
lang = lang,
sc = sc,
term = term,
alt = alt,
id = id
},
allowSelfLink
)
if term then
return term
else
term = "<small></small>"
if mw.title.getCurrentTitle().nsText ~= "Template" then
term = term .. require("Module:0utilities").format_categories({lang:getNonEtymologicalName() .. " term requests"}, lang, "-", nil, nil, sc)
end
return term
end
end
function export.def_t(frame)
local args = require("Module:0parameters").process(frame:getParent().args, mw.loadData("Module:0parameters/data").def_t)
local lang = require("Module:0languages").getByCode("en")
local sc = require("Module:0scripts").getByCode("Latn")
local text = require("Module:0links").embedded_language_links(
{
term = args,
lang = lang,
sc = sc
},
true
)
return require("Module:0script utilities").tag_text(text, lang, sc)
end
function export.linkify_t(frame)
local args = require("Module:0parameters").process(frame:getParent().args, mw.loadData("Module:0parameters/data").linkify_t)
args = mw.text.trim(args)
if args == "" or args:find("[[", nil, true) then
return args
else
return " .. "]]"
end
end
function export.section_link_t(frame)
local args = require("Module:0parameters").process(frame:getParent().args, mw.loadData("Module:0parameters/data").section_link_t)
return require("Module:0links").section_link(args)
end
function export.language_name_link_t(frame)
local m_debug = require("Module:0debug")
local m_params_data = mw.loadData("Module:0parameters/data")
local face = frame.args
local allowSelfLink = frame.args; allowSelfLink = not allowSelfLink or allowSelfLink == ""
local params = m_params_data.language_name_link_t
-- 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 = m_params_data.language_name_link_t_compat
end
local args = require("Module:0parameters").process(frame:getParent().args, params)
local lang = args
-- Tracking for missing language or und
if not lang then
m_debug.track("link/no lang")
elseif lang == "und" then
m_debug.track("link/und")
end
lang = lang or "und"
local sc = args
local term = args
local alt = args
-- Check parameters
lang = require("Module:0languages").getByCode(lang, 1, true)
if sc then
sc = require("Module:0scripts").getByCode(sc, "sc")
end
if not term and not alt and frame.args then
term = frame.args
end
--[[
Add a language name, linked to Wikipedia if the Wikipedia parameter is set to true.
Forward the information to full_link.
]]
local language_name = args.w and lang:makeWikipediaLink() or lang:getCanonicalName()
if term == "-" then
return language_name
else
return language_name .. " " ..
require("Module:0links").full_link(
{
lang = lang,
sc = sc,
term = term,
alt = alt,
gloss = args,
id = args,
tr = args,
ts = args,
genders = args,
pos = args,
lit = args
},
face,
allowSelfLink
)
end
end
return export