Module:tln-headword: Difference between revisions

From Linguifex
Jump to navigation Jump to search
Nehster9 (talk | contribs)
mNo edit summary
Nehster9 (talk | contribs)
mNo edit summary
Line 26: Line 26:


if pl ~= "" then
if pl ~= "" then
     text = text .. ", plural '''[[" .. pl .. "]]'''"
     text = text .. " plural '''[[" .. pl .. "]]'''"


     if plrom ~= "" then
     if plrom ~= "" then

Revision as of 19:24, 18 June 2026



local p = {}

function p.noun(frame)
    local args = frame:getParent().args

    local title = mw.title.getCurrentTitle().text

local g = args.g or "?"
local rom = args.rom or ""
local pl = args.pl or ""
local plrom = args.plrom or ""

local gender_map = {
    m = "m.",
    f = "f.",
    n = "n."
}

local text = "'''" .. title .. "'''"

if rom ~= "" then
    text = text .. " • (" .. rom .. ")"
end

text = text .. " ''" .. (gender_map[g] or (g .. ".")) .. "''"

if pl ~= "" then
    text = text .. " plural '''[[" .. pl .. "]]'''"

    if plrom ~= "" then
        text = text .. " (" .. plrom .. ")"
    end
end

    return text
end

return p