10,731
edits
No edit summary |
TheNightAvl (talk | contribs) (Replaced string library with mw.ustring library, as epenthetic "e" in pluralisation was not working.) |
||
Line 6: | Line 6: | ||
local function is_non_lemma(pos) | local function is_non_lemma(pos) | ||
return | return mw.ustring.find(pos, "%sform") and true or false | ||
end | end | ||
local function pluralize(word) | local function pluralize(word) | ||
local ending = | local ending = mw.ustring.sub(word, -1) | ||
if ending == "h" and | if ending == "h" and mw.ustring.sub(word, -2, -1) == "s" then ending = "sh" end | ||
if ending == "s" or ending == "z" or ending == "x" or ending == "sh" then | if ending == "s" or ending == "z" or ending == "x" or ending == "sh" then | ||
return word .. "es" | return word .. "es" | ||
Line 29: | Line 29: | ||
if data.head then | if data.head then | ||
head = data.head | head = data.head | ||
elseif | elseif mw.ustring.find(head, " ") then | ||
local pieces = {} | local pieces = {} | ||
for piece in | for piece in mw.ustring.gmatch(head, "%S+") do | ||
table.insert(pieces, "[[" .. piece .. "]]") | table.insert(pieces, "[[" .. piece .. "]]") | ||
end | end | ||
head = table.concat(pieces, " ") | head = table.concat(pieces, " ") | ||
end | end | ||
if | if mw.ustring.find(head, " ") then | ||
cats = cats .. "[[Category:" .. data.language.name .. " multiword terms]]" | cats = cats .. "[[Category:" .. data.language.name .. " multiword terms]]" | ||
end | end |