Module:nyms: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 15: Line 15:
function export.make_nym_list(data)
function export.make_nym_list(data)
local links = {}
local links = {}
local plural = ""
for i, term in ipairs(data.terms) do
for i, term in ipairs(data.terms) do
local i_term, i_args = m_inline.parse(term)
local i_term, i_args = m_inline.parse(term)
Line 27: Line 28:
)
)
end
end
return '<span class="nyms" data-label="' .. data.label .. '"><span class="nyms-label">' .. data.label:gsub("^%l", string.upper) .. ':</span> ' .. table.concat(links, ", ") .. '</span>'
if #links > 1 then plural = "s" end
return '<span class="nyms" data-label="' .. data.label .. 's"><span class="nyms-label">' .. data.label:gsub("^%l", string.upper) .. plural .. ':</span> ' .. table.concat(links, ", ") .. '</span>'
end
end