Module:etymology: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 87: Line 87:
     },
     },
     ["calque"] = {
     ["calque"] = {
         text = function(nocap) return (nocap and "b" or "B") .. "y [[Appendix:Glossary#surface analysis|surface analysis]], " end,
         text = true,
         categories = {"terms calqued from"},
         categories = {"terms calqued from"},
     },
     },
Line 126: Line 126:
     ["pos"] = {list = true, allow_holes = true},
     ["pos"] = {list = true, allow_holes = true},
     ["noaff"] = {list = true, allow_holes = true, type = "boolean"},
     ["noaff"] = {list = true, allow_holes = true, type = "boolean"},
    ["notext"] = {type = "boolean"},
    ["nocap"] = {type = "boolean"},
     ["nocat"] = {type = "boolean"},
     ["nocat"] = {type = "boolean"},
}
local affix_data = {
    ["affix"] = {},
    ["surface analysis"] = {
        text = function(nocap) return (nocap and "b" or "B") .. "y [[Appendix:Glossary#surface analysis|surface analysis], " end
    }
}
}
local affix_delimiter = {
local affix_delimiter = {
Line 223: Line 231:
end
end


local function affix_etymology(frame)
local function affix_etymology(template, frame)
     local args = m_parameters.process(frame:getParent().args, affix_params)
     local data, args = affix_data[template], m_parameters.process(frame:getParent().args, affix_params)
     local pre_out, categories = {}, {}
     local pre_out, categories = {}, {}
     local language_to = m_languages.get_by_code(args[1])
     local language_to = m_languages.get_by_code(args[1])
Line 263: Line 271:
     if (not args["nocat"]) and (n_parts > 1 and n_affixes == 0) then
     if (not args["nocat"]) and (n_parts > 1 and n_affixes == 0) then
         table.insert(categories, language_to.name .. " compound terms")
         table.insert(categories, language_to.name .. " compound terms")
    end
    local out = table.concat(pre_out, " + ")
    if not args["notext"] then
        out = format_prefixed_text(template, data["text"], args["nocap"]) .. out
     end
     end
     return format_etymology(table.concat(pre_out, " + "), categories)
     return format_etymology(table.concat(pre_out, " + "), categories)
Line 272: Line 284:
     if single_term_data[template] then return single_term_etymology(template, frame) end
     if single_term_data[template] then return single_term_etymology(template, frame) end
     if derived_term_data[template] then return derived_term_etymology(template, frame) end
     if derived_term_data[template] then return derived_term_etymology(template, frame) end
     if template == "affix" then return affix_etymology(frame) end
     if affix_data[template] then return affix_etymology(template, frame) end
     error("No such sub-template type is defined!")
     error("No such sub-template type is defined!")
end
end


return export
return export

Navigation menu