local m_lb = require("Module:labels")
local export = {}
function export.show(frame)
local args = frame:getParent().args
local pagename = mw.title.getCurrentTitle().text
if (args == nil and mw.title.getCurrentTitle().nsText == "Template") then
args = "und"
end
local lang = require("Module:languages").getByCode(args, 1)
local nocat = args ~= nil
local sort_key = args
local term_mode = (frame.args) ~= nil
local labels = get_labels(args, require("Module:languages").getByCode(args):getCanonicalName())
return m_lb.show_labels {
labels = labels,
lang = lang,
sort = sort_key,
nocat = nocat,
mode = term_mode and "term-label" or nil,
}
end
function get_labels(args, langname)
local labels = {}
local indtr = ""
local i = 2
local q = nil
local first = true
local andwith = false
if (args ~= nil) then
indtr = indtr .. "], or "
end
while (args ~= nil) do
if (mw.ustring.sub(args, 0, 1) == ".") then
table.insert(labels, mw.ustring.sub(args, 2));
elseif (args == ";") then
andwith = true
if (args == nil or args == "") then
indtr = indtr .. " and with "
else
indtr = indtr .. " and " .. args .. " with "
end
else
if (first == false) then
if (andwith == true) then
andwith = false
else
indtr = indtr .. " or "
end
else
if (args ~= nil and args ~= nil) then
indtr = indtr .. "], ] with "
elseif (args ~= nil) then
indtr = indtr .. "[[Appendix:Glossary#copulative|copulative}} with "
elseif (args ~= nil) then
indtr = indtr .. "], with the indirect object taking "
elseif (args ~= nil) then
indtr = indtr .. "] with "
else
indtr = indtr .. "] with "
end
first = false
end
if (mw.ustring.sub(args, 0, 1) == "-") then
indtr = indtr .. mw.ustring.sub(args, 2);
else
indtr = indtr .. "''''' .. "#" .. langname .. "|" .. args .. "]]'''''"
end
indtr = indtr .. qualifier(args)
end
i = i + 1
end
if (args ~= nil) then
if (args ~= nil) then
indtr = indtr .. " or no preposition"
else
indtr = indtr .. " or with no preposition"
end
indtr = indtr .. qualifier(args)
end
if (args ~= nil) then
indtr = indtr .. " and a verb in the " .. args
elseif (args ~= nil and args ~= nil) then
indtr = indtr .. " for the second object"
end
table.insert(labels, indtr)
return labels
end
function qualifier(text)
if (text == nil or text == "") then return "" end
return ' <span class="ib-brac"><span class="qualifier-brac">(</span></span><span class="ib-content"><span class="qualifier-content">' .. text ..
'</span></span><span class="ib-brac"><span class="qualifier-brac">)</span></span>'
end
return export