Module:head: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 50: Line 50:
if ((not data.inflections) and (not data.labels)) or (#data.inflections < 1 and #data.labels < 1) then return nil end
if ((not data.inflections) and (not data.labels)) or (#data.inflections < 1 and #data.labels < 1) then return nil end
local out = {}
local out = {}
for _, inflection in pairs(data.inflections) do
if data.inflections then
if not inflection.label then error("headword inflection must have a label") end
for _, inflection in pairs(data.inflections) do
local i_forms = {}
if not inflection.label then error("headword inflection must have a label") end
local i = 1
local i_forms = {}
while inflection[i] do
local i = 1
table.insert(i_forms, m_links.full_link({term = inflection[i], language = data.language}, "bold"))
while inflection[i] do
i = i + 1
table.insert(i_forms, m_links.full_link({term = inflection[i], language = data.language}, "bold"))
i = i + 1
end
if #i_forms > 0 then
table.insert(out, "''" .. inflection.label .. "'' " .. table.concat(i_forms, ", "))
end
end
end
if #i_forms > 0 then
end
table.insert(out, "''" .. inflection.label .. "'' " .. table.concat(i_forms, ", "))
if data.labels then
for _, label in ipairs(data.labels) do
table.insert(out, "''" .. "[[Appendix:Glossary#" .. label .. "|" .. label .. "]]''")
end
end
end
for _, label in ipairs(data.labels) do
table.insert(out, "''" .. "[[Appendix:Glossary#" .. label .. "|" .. label .. "]]''")
end
end
if #out < 1 then return nil end
if #out < 1 then return nil end