Module:mak-headword

Hello, you have come here looking for the meaning of the word Module:mak-headword. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:mak-headword, but we will also tell you about its etymology, its characteristics and you will know how to say Module:mak-headword in singular and plural. Everything you need to know about the word Module:mak-headword you have here. The definition of the word Module:mak-headword will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:mak-headword, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local insert = table.insert
local u = require("Module:string utilities").char

local lang = require("Module:languages").getByCode("mak")

local export = {}
local pos_functions = {}

-----------------------
-- Utility functions --
-----------------------

-- If Not Empty
local function ine(arg)
    if arg == "" then
        return nil
    else
        return arg
    end
end

local function list_to_set(list)
    local set = {}
    for _, item in ipairs(list) do set = true end
    return set
end

-- version of mw.ustring.gsub() that discards all but the first return value
function rsub(term, foo, bar)
    local retval = mw.ustring.gsub(term, foo, bar)
    return retval
end

local function make_unused_key_tracker(t)
	local unused_keys = require "Module:table".listToSet(require "Module:table".keysToList(t))
	local mt = {
		__index = function(self, key)
			if key ~= nil then
				unused_keys = nil
			end
			return t
		end,
		__newindex = function(self, key, value)
			t = value
		end
	}
	local proxy_table = setmetatable({}, mt)
	return proxy_table, unused_keys
end

local rfind = mw.ustring.find

local function append_cat(data, pos)
    insert(data.categories, lang:getCanonicalName() .. " " .. pos)
end

function remove_links(text)
    text = rsub(text, "%]*|", "")
    text = rsub(text, "%[%[", "")
    text = rsub(text, "%]%]", "")
    return text
end

local function otherscript(inflections, args)
    local title = mw.title.getCurrentTitle()
    local sc = lang:findBestScript(title.subpageText)

    local other_sc

    if sc:getCode() == "Latn" then
        local inflection = {label = "Lontara spelling"}

        if not tr then
            tr = require("Module:mak-Latn-Bugi-translit").tr(
                     require("Module:links").remove_links(
                         mw.title.getCurrentTitle().text), "mak", sc:getCode())
        end

        insert(inflection, {term = tr})
        insert(inflections, inflection)
    end
end

-- The main entry point.
function export.show(frame)

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

    local poscat = frame.args or error(
                       "Part of speech has not been specified. Please pass parameter 1 to the module invocation.")

    local params = {
         = {list = "head", allow_holes = true, default = ""},
         = {default = ""}
    }

	local args, unused_keys = make_unused_key_tracker(frame:getParent().args)

    -- Gather parameters
    local data = {
        lang = lang,
        pos_category = poscat,
        categories = {},
        heads = {},
        translits = {},
        inflections = {},
        altform = lang:findBestScript(PAGENAME):getCode() ~= "Latn"
    }

    otherscript(data.inflections, args)

    if pos_functions then pos_functions.func(args, data) end

    local unused_key_list = require"Module:table".keysToList(unused_keys)
    if #unused_key_list > 0 then
        local unused_key_string = require "Module:array"(unused_key_list):map(
                                      function(key)
                return "|" .. key .. "=" .. args
            end):concat("\n")
        error("Unused arguments: " .. unused_key_string)
    end

    return require("Module:headword").full_headword(data)
end

local function getargs(args, argpref, position)
    -- Gather parameters
    local forms = {}

    if ine(args) then
        form = ine(args)
    else
        form = ine(args)
    end

    local i = 1

    while form do

        insert(forms, {term = form})

        i = i + 1
        form = ine(args)
    end

    return forms
end

local function handle_infl(args, data, argpref, label, position)
    local newinfls = getargs(args, argpref, position)
    newinfls.label = label

    if #newinfls > 0 then insert(data.inflections, newinfls) end
end

pos_functions = {
    func = function(args, data)
        data.pos_category = "verbs"
        handle_infl(args, data, "st", "semi-transitive", 1)
    end
}

pos_functions = {
    func = function(args, data)
        data.pos_category = "nouns"
        handle_infl(args, data, "def", "definite", 1)
    end
}

return export