Module:compound: Difference between revisions

no edit summary
(Created page with "local m_links = require("Module:links") local m_utilities = require("Module:utilities") local export = {} local u = mw.ustring.char local rsub = mw.ustring.gsub local usub =...")
 
No edit summary
Line 402: Line 402:
else
else
display_term = part.term
display_term = part.term
if affix_type then
if not affix_type then
require("Module:debug").track{
"compound",
"compound/" .. affix_type,
"compound/" .. affix_type .. "/lang/" .. lang:getCode()
}
else
whole_words = whole_words + 1
whole_words = whole_words + 1
end
end
end
end
table.insert(parts_formatted, link_term(part, display_term, lang, sc, sort_key))
table.insert(parts_formatted, link_term(part, display_term, lang, sc, sort_key))
end
if whole_words == 1 then
require("Module:debug").track("compound/one whole word")
elseif whole_words == 0 then
require("Module:debug").track("compound/looks like confix")
end
end
Line 467: Line 455:
part.tr = export.make_affix(part.tr, part_lang, require("Module:scripts").getByCode("Latn"), affix_type)
part.tr = export.make_affix(part.tr, part_lang, require("Module:scripts").getByCode("Latn"), affix_type)
part.ts = export.make_affix(part.ts, part_lang, require("Module:scripts").getByCode("Latn"), affix_type)
part.ts = export.make_affix(part.ts, part_lang, require("Module:scripts").getByCode("Latn"), affix_type)
end
local function track_wrong_affix_type(template, part, lang, sc, expected_affix_type, part_name)
if part then
local affix_type = get_affix_type(part.lang or lang, part.sc or sc, part.term)
if affix_type ~= expected_affix_type then
require("Module:debug").track{
template,
template .. "/" .. part_name,
template .. "/" .. part_name .. "/" .. (affix_type or "none"),
template .. "/" .. part_name .. "/" .. (affix_type or "none") .. "/lang/" .. lang:getCode()
}
end
end
end
end


Line 503: Line 476:
make_part_affix(suffix, lang, sc, "suffix")
make_part_affix(suffix, lang, sc, "suffix")
track_wrong_affix_type("circumfix", prefix, lang, sc, "prefix", "prefix")
track_wrong_affix_type("circumfix", base, lang, sc, nil, "base")
track_wrong_affix_type("circumfix", suffix, lang, sc, "suffix", "suffix")
-- Create circumfix term
-- Create circumfix term
Line 542: Line 512:
make_part_affix(suffix, lang, sc, "suffix")
make_part_affix(suffix, lang, sc, "suffix")
track_wrong_affix_type("confix", prefix, lang, sc, "prefix", "prefix")
track_wrong_affix_type("confix", base, lang, sc, nil, "base")
track_wrong_affix_type("confix", suffix, lang, sc, "suffix", "suffix")
-- Make links out of all the parts
-- Make links out of all the parts
Line 581: Line 548:
make_part_affix(infix, lang, sc, "infix")
make_part_affix(infix, lang, sc, "infix")
track_wrong_affix_type("infix", base, lang, sc, nil, "base")
track_wrong_affix_type("infix", infix, lang, sc, "infix", "infix")
-- Make links out of all the parts
-- Make links out of all the parts
Line 606: Line 571:
make_part_affix(prefix, lang, sc, "prefix")
make_part_affix(prefix, lang, sc, "prefix")
end
end
for i, prefix in ipairs(prefixes) do
track_wrong_affix_type("prefix", prefix, lang, sc, "prefix", "prefix")
end
track_wrong_affix_type("prefix", base, lang, sc, nil, "base")


-- Make links out of all the parts
-- Make links out of all the parts
Line 651: Line 610:
for i, suffix in ipairs(suffixes) do
for i, suffix in ipairs(suffixes) do
make_part_affix(suffix, lang, sc, "suffix")
make_part_affix(suffix, lang, sc, "suffix")
end
track_wrong_affix_type("suffix", base, lang, sc, nil, "base")
for i, suffix in ipairs(suffixes) do
track_wrong_affix_type("suffix", suffix, lang, sc, "suffix", "suffix")
end
end