45,660
edits
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
["verbs"] = "verbs", | ["verbs"] = "verbs", | ||
} | } | ||
local function format_inflection_parts(data, parts) | |||
local m_links = require("Module:links") | |||
for key, part in ipairs(parts) do | |||
if type(part) ~= "table" then | |||
part = {term = part} | |||
end | |||
local partaccel = part.accel | |||
local face = part.hypothetical and "hypothetical" or "bold" | |||
local nolink = part.hypothetical or part.nolink | |||
-- Convert the term into a full link | |||
-- Don't show a transliteration here, the consensus seems to be not to | |||
-- show them in headword lines to avoid clutter. | |||
part = m_links.full_link( | |||
{ | |||
term = not nolink and part.term or nil, | |||
alt = part.alt or (nolink and part.term or nil), | |||
lang = part.lang or data.lang, | |||
sc = part.sc or parts.sc or (not part.lang and data.sc), | |||
id = part.id, | |||
genders = part.genders, | |||
tr = part.translit or (not (parts.enable_auto_translit or data.inflections.enable_auto_translit) and "-" or nil), | |||
ts = part.transcription, | |||
accel = parts.accel or partaccel, | |||
}, | |||
face, | |||
false | |||
) | |||
part = qualifiers .. part | |||
parts[key] = part | |||
end | |||
local parts_output = "" | |||
if #parts > 0 then | |||
parts_output = " " .. table.concat(parts, " <i>or</i> ") | |||
end | |||
return "<i>" .. parts.label .. "</i>" .. parts_output | |||
end | |||
-- Format the inflections following the headword | |||
local function format_inflections(data) | |||
if data.inflections and #data.inflections > 0 then | |||
-- Format each inflection individually | |||
for key, infl in ipairs(data.inflections) do | |||
data.inflections[key] = format_inflection_parts(data, infl) | |||
end | |||
return " (" .. table.concat(data.inflections, ", ") .. ")" | |||
else | |||
return "" | |||
end | |||
end | |||
local function format_genders(data) | local function format_genders(data) |