Module:category tree/affixes and compounds: Difference between revisions

No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 219: Line 219:


table.insert(handlers, function(data)
table.insert(handlers, function(data)
local labelpref, pos, affixtype, term_and_id = data.label:match("^(([%w' -]+) ([a-z]+fix)ed with )(.+)$")
local labelpref, pos, affixtype, term_and_id = data.label:match("^(([a-z -]+) ([a-z]+fix)ed with )(.+)$")
if affixtype then
if affixtype then
local term, id = term_and_id:match("^(.+) %(([^()]+)%)$")
local term, id = term_and_id:match("^(.+) %(([^()]+)%)$")
Line 270: Line 270:
local parents = {}
local parents = {}
if id then
if id then
if pos == "words" then
if pos == "terms" or pos == "words" then
-- don't allow formerly-named categories with "words"
return nil
end
if pos == "terms" then
table.insert(parents, {name = labelpref .. term, sort = id, args = args})
table.insert(parents, {name = labelpref .. term, sort = id, args = args})
else
else
table.insert(parents, {name = "terms " .. affixtype .. "ed with " .. term_and_id, sort = id .. ", " .. pos, args = args})
table.insert(parents, {name = pos .. " " .. affixtype .. "ed with " .. term_and_id, sort = id .. ", " .. pos, args = args})
table.insert(parents, {name = labelpref .. term, sort = id, args = args})
table.insert(parents, {name = labelpref .. term, sort = id, args = args})
end
end
elseif pos == "words" then
-- don't allow formerly-named categories with "words"
return nil
elseif pos ~= "terms" then
elseif pos ~= "terms" then
table.insert(parents, {name = "terms " .. affixtype .. "ed with " .. term, sort = pos, args = args})
table.insert(parents, {name = "terms " .. affixtype .. "ed with " .. term, sort = pos, args = args})